diff --git a/c-programming/experiments/floatscan-experiment.c b/c-programming/experiments/floatscan-experiment.c index 66268cf..77fb939 100644 --- a/c-programming/experiments/floatscan-experiment.c +++ b/c-programming/experiments/floatscan-experiment.c @@ -47,6 +47,7 @@ /* wrapping code --- beginning */ const char* fgetc_ptr = NULL; +static long double copysignl(long double mag, long double sgn); static int __shgetc(void); static int __shunget(void); static long double interface_floatscan(const char* s, int prec); @@ -567,6 +568,10 @@ long double __floatscan(FILE *f, int prec, int pok) /* the original musl libc code --- end */ /* wrapping code --- beginning */ +static long double copysignl(long double mag, long double sgn) { + return fabsl(mag) * (sgn < 0 ? -1 : 1); +} + static int __shgetc(void) { return *fgetc_ptr++; }