2 * Simple implementations of some C99 library functions.
3 * Note that the goal of altfloat is not to create a C99 math library: these
4 * functions are intended to just be "good enough" on platforms where they are
7 * Copyright (C) 2010 Nick Bowler.
9 * License BSD2: 2-clause BSD license. See LICENSE for full terms.
10 * This is free software: you are free to change and redistribute it.
11 * There is NO WARRANTY, to the extent permitted by law.
18 double nan(const char *tagp
)
27 return log(x
) / log(2);
39 double fma(double x
, double y
, double z
)
46 double remquo(double x
, double y
, int *quo
)
48 unsigned tmp
= fabs(round(x
/y
));
49 int sign
= signbit(x
/y
) ? -1 : 1;
51 *quo
= sign
* (int)(tmp
% (INT_MAX
+ 1u));
52 return remainder(x
, y
);