mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
musl: Fix limiting the float precision in intermediates.
musl itself expects to be configured to compile with either -ffloat-store or -fexcess-precision=standard - but when imported into Wine, those flags aren't used. This seems to be essential for getting reasonable precision from some math functions such as exp2() - without the expected precision truncation, the output value of exp2() can be off by as much as 0.2% in some cases. As Wine doesn't build the musl sources with those flags, use volatile to force storing/reloading floats in order to limit their intermediate precision, as musl expects. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56372
This commit is contained in:
parent
e2e1ccb58a
commit
3607eae620
Notes:
Alexandre Julliard
2024-10-15 00:04:51 +02:00
Approved-by: Piotr Caban (@piotr) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6668
1 changed files with 6 additions and 3 deletions
|
@ -104,17 +104,20 @@ static int32_t converttoint(double_t);
|
|||
/* Evaluate an expression as the specified type. With standard excess
|
||||
precision handling a type cast or assignment is enough (with
|
||||
-ffloat-store an assignment is required, in old compilers argument
|
||||
passing and return statement may not drop excess precision). */
|
||||
passing and return statement may not drop excess precision).
|
||||
|
||||
If compiled without -ffloat-store or -fexcess-precision=standard,
|
||||
an extra volatile qualifier here will force limiting the precision. */
|
||||
|
||||
static inline float eval_as_float(float x)
|
||||
{
|
||||
float y = x;
|
||||
volatile float y = x;
|
||||
return y;
|
||||
}
|
||||
|
||||
static inline double eval_as_double(double x)
|
||||
{
|
||||
double y = x;
|
||||
volatile double y = x;
|
||||
return y;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue