diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-02-03 19:01:32 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-02-03 22:06:42 +0100 |
commit | b1a207c6df0a9c5555017f65f8731acf8d4c14c2 (patch) | |
tree | fca99fd7efdcdf6fc71b042be6df26de755c9468 /libphobos/src/std/math.d | |
parent | b52a1dfe12a6303c7649f3ff5b8dac6c1001d49a (diff) | |
download | gcc-b1a207c6df0a9c5555017f65f8731acf8d4c14c2.zip gcc-b1a207c6df0a9c5555017f65f8731acf8d4c14c2.tar.gz gcc-b1a207c6df0a9c5555017f65f8731acf8d4c14c2.tar.bz2 |
libphobos: Merge upstream druntime 9d0c8364, phobos 9d575282e.
Druntime changes:
- Add platform-specific bindings for stdlib.h and sys/syctl.h.
- Add darwin bindings for mach/dyld.h.
- Fix solaris bindings for locale.h (PR98910).
- Remove deprecated bindings from the module headers.
Phobos changes:
- Backport platform-specific fixes for std.conv, std.datetime,
std.exception, std.experimental.allocator, std.file, std.math,
std.parallelism, std.socket, std.stdio, and std.system.
Reviewed-on: https://github.com/dlang/druntime/pull/3363
https://github.com/dlang/phobos/pull/7784
libphobos/ChangeLog:
PR d/98910
* libdruntime/MERGE: Merge upstream druntime 9d0c8364.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add
core/internal/attributes.d
(DRUNTIME_DSOURCES_BIONIC): Add core/sys/bionic/stdlib.d.
(DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/stdlib.d, and
core/sys/darwin/sys/sysctl.d.
(DRUNTIME_DSOURCES_DRAGONFLYBSD): Add
core/sys/dragonflybsd/stdlib.d, and
core/sys/dragonflybsd/sys/sysctl.d.
(DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/stdlib.d, and
core/sys/freebsd/sys/sysctl.d.
(DRUNTIME_DSOURCES_NETBSD): Add core/sys/netbsd/stdlib.d, and
core/sys/netbsd/sys/sysctl.d.
(DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/stdlib.d, and
core/sys/openbsd/sys/sysctl.d.
(DRUNTIME_DSOURCES_SOLARIS): Add core/sys/solaris/stdlib.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 9d575282e.
Diffstat (limited to 'libphobos/src/std/math.d')
-rw-r--r-- | libphobos/src/std/math.d | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d index 3d18cfa..ff368b7 100644 --- a/libphobos/src/std/math.d +++ b/libphobos/src/std/math.d @@ -167,19 +167,14 @@ version (SystemZ) version = IBMZ_Any; version (RISCV32) version = RISCV_Any; version (RISCV64) version = RISCV_Any; -version (D_InlineAsm_X86) -{ - version = InlineAsm_X86_Any; -} -else version (D_InlineAsm_X86_64) -{ - version = InlineAsm_X86_Any; -} +version (D_InlineAsm_X86) version = InlineAsm_X86_Any; +version (D_InlineAsm_X86_64) version = InlineAsm_X86_Any; -version (CRuntime_Microsoft) +version (InlineAsm_X86_Any) version = InlineAsm_X87; +version (InlineAsm_X87) { - version (InlineAsm_X86_Any) - version = MSVC_InlineAsm; + static assert(real.mant_dig == 64); + version (CRuntime_Microsoft) version = InlineAsm_X87_MSVC; } version (X86_64) version = StaticallyHaveSSE; @@ -3610,7 +3605,7 @@ real log1p(real x) @safe pure nothrow @nogc real log2(real x) @safe pure nothrow @nogc { version (INLINE_YL2X) - return core.math.yl2x(x, 1); + return core.math.yl2x(x, 1.0L); else { // Special cases are the same as for log. @@ -4586,19 +4581,21 @@ real round(real x) @trusted nothrow @nogc * If the fractional part of x is exactly 0.5, the return value is rounded * away from zero. * - * $(BLUE This function is Posix-Only.) + * $(BLUE This function is not implemented for Digital Mars C runtime.) */ long lround(real x) @trusted nothrow @nogc { - version (Posix) - return core.stdc.math.llroundl(x); - else + version (CRuntime_DigitalMars) assert(0, "lround not implemented"); + else + return core.stdc.math.llroundl(x); } -version (Posix) +/// +@safe nothrow @nogc unittest { - @safe nothrow @nogc unittest + version (CRuntime_DigitalMars) {} + else { assert(lround(0.49) == 0); assert(lround(0.5) == 1); |