|
@@ -35,21 +35,10 @@ HL_PRIM vbyte *hl_ftos( double d, int *len ) {
|
|
|
*len = 3;
|
|
|
return hl_copy_bytes((vbyte*)USTR("NaN"),8);
|
|
|
}
|
|
|
-# if defined(HL_VCC) && !defined(HL_64)
|
|
|
- /*
|
|
|
- For some unknown reason, we reach here with some conditional bits set in FPU status,
|
|
|
- leading to a crash in sprintf (reproducible with -1.0 value).
|
|
|
- Let's then make sure to save/restore FPU state
|
|
|
- */
|
|
|
- __declspec(align(16)) char fpu[512];
|
|
|
- _fxsave(fpu);
|
|
|
- __asm { finit };
|
|
|
-# endif
|
|
|
- k = (int)usprintf(tmp,24,USTR("%.16g"),d); // don't use the last digit (eg 5.1 = 5.09999..996)
|
|
|
+ // don't use the last digit (eg 5.1 = 5.09999..996)
|
|
|
+ // also cut one more digit for some numbers (eg 86.57 and 85.18) <- to fix since we lose one PI digit
|
|
|
+ k = (int)usprintf(tmp,24,USTR("%.15g"),d);
|
|
|
*len = k;
|
|
|
-# if defined(HL_VCC) && !defined(HL_64)
|
|
|
- _fxrstor(fpu);
|
|
|
-# endif
|
|
|
return hl_copy_bytes((vbyte*)tmp,(k + 1) << 1);
|
|
|
}
|
|
|
|