libc: fprem fmod()
This commit is contained in:
parent
52f35de578
commit
d63c98b6bf
|
@ -78,14 +78,15 @@ float fabsf(float x) {
|
||||||
|
|
||||||
double fmod(double x, double y) {
|
double fmod(double x, double y) {
|
||||||
MATH;
|
MATH;
|
||||||
if (x >= 0.0) {
|
|
||||||
while (x > y) {
|
long double out;
|
||||||
x -= y;
|
asm volatile (
|
||||||
}
|
"1: fprem;" /* Partial remainder */
|
||||||
return x;
|
" fnstsw %%ax;" /* store status word */
|
||||||
} else {
|
" sahf;" /* store AX (^ FPU status) into flags */
|
||||||
return 0.0;
|
" jp 1b;" /* jump back to 1 above if parity flag==1 */
|
||||||
}
|
: "=t"(out) : "0"(x), "u"(y) : "ax", "cc");
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
double sqrt(double x) {
|
double sqrt(double x) {
|
||||||
|
|
Loading…
Reference in New Issue