Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit 90aedda

Browse files
committed
Backport: std.math: Use core.stdc.fenv for RoundingMode values
03b3d7fb302c0d9ebb975d921691b2443059fe82
1 parent 676859a commit 90aedda

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

libphobos/src/std/math.d

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5044,34 +5044,25 @@ struct FloatingPointControl
50445044
roundToZero /// ditto
50455045
}
50465046
}
5047-
else version(ARM)
5048-
{
5049-
enum : RoundingMode
5050-
{
5051-
roundToNearest = 0x000000,
5052-
roundDown = 0x800000,
5053-
roundUp = 0x400000,
5054-
roundToZero = 0xC00000
5055-
}
5056-
}
5057-
else version(PPC_Any)
5047+
else version (CRuntime_Microsoft)
50585048
{
5049+
// Microsoft uses hardware-incompatible custom constants in fenv.h (core.stdc.fenv).
50595050
enum : RoundingMode
50605051
{
5061-
roundToNearest = 0x00000000,
5062-
roundDown = 0x00000003,
5063-
roundUp = 0x00000002,
5064-
roundToZero = 0x00000001
5052+
roundToNearest = 0x0000,
5053+
roundDown = 0x0400,
5054+
roundUp = 0x0800,
5055+
roundToZero = 0x0C00
50655056
}
50665057
}
50675058
else
50685059
{
50695060
enum : RoundingMode
50705061
{
5071-
roundToNearest = 0x0000,
5072-
roundDown = 0x0400,
5073-
roundUp = 0x0800,
5074-
roundToZero = 0x0C00
5062+
roundToNearest = core.stdc.fenv.FE_TONEAREST,
5063+
roundDown = core.stdc.fenv.FE_DOWNWARD,
5064+
roundUp = core.stdc.fenv.FE_UPWARD,
5065+
roundToZero = core.stdc.fenv.FE_TOWARDZERO,
50755066
}
50765067
}
50775068

0 commit comments

Comments
 (0)