Commit graph

617 commits

Author SHA1 Message Date
Andrei Alexandrescu
f97c2c05be
Provide float and double versions of fmin and fmax. Improve docs. (#7604)
Provide float and double versions of fmin and fmax. Improve docs.
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2020-09-09 07:13:00 +02:00
Martin Kinkelin
1e15cf6e0d std.math: Avoid ldexp calls with constant exponents
Quoting from https://en.cppreference.com/w/cpp/numeric/math/ldexp:

> On many implementations, std::ldexp is less efficient than
> multiplication or division by a power of two using arithmetic
> operators.
2020-08-15 02:07:39 +02:00
Martin Kinkelin
a76200dd17 std.math: Enable proper single- and double-precision ldexp overloads
As the according intrinsics have recently been added to core.math.

Also move `pragma(inline, true)` out of the function as required for LDC
(and non-templated functions, not getting their body analyzed).
2020-08-15 02:00:58 +02:00
Martin Kinkelin
4d3ba080b7
Prepare for properly parsed float/double literals (#7591)
This fixes failing unittests with dlang/dmd#11387 on Linux x64 by
appending a L suffix to (some) literals, to keep full `real` parsing
precision (instead of double precision).
2020-08-14 21:06:56 +08:00
Nathan Sashihara
453faadf5b Replace is(Unqual!T == Unqual!U) with is(immutable T == immutable U) for speed & memory usage 2020-08-03 15:07:32 +02:00
Walter Bright
5a0dddcb98 fix fabs() to not use x87 for float/double 2020-07-21 01:18:10 -07:00
Iain Buclaw
22ebc705c1 std.math: Begin deprecation of accidentally leaked AliasSeq 2020-07-03 05:37:57 +02:00
Iain Buclaw
268b56be49 std.math: Remove duplicated RISCV version conditions 2020-06-29 16:35:52 +02:00
Martin Nowak
fa87fdc1fc Merge remote-tracking branch 'upstream/stable' into merge_stable 2020-06-12 00:12:33 +02:00
Martin Kinkelin
a7a1e0dc4e
std.math: Fix comment for isIdentical 2020-06-07 16:32:15 +02:00
Walter Bright
016b33a1a4 scalbn() doesn't inline 2020-06-05 21:46:27 -07:00
Nathan Sashihara
0a0b03353e Fix documentation of std.math.isIdentical for NaN: compares all bits not just payload 2020-06-05 18:48:25 -07:00
Kazuya Takahashi
3d56e642ac Add nearbyint, lround, remainder, remquo for MS CRT 2020-05-24 18:18:18 +08:00
Iain Buclaw
6c7555c3f6 std.math: Remove redundnt public from top-level module 2020-05-17 00:02:09 +02:00
Iain Buclaw
165b2808f0 std.math: Remove redundnt public from FloatingPointControl 2020-05-17 00:01:22 +02:00
Iain Buclaw
f063e1936f std.math: Remove redundant private from IeeeFlags 2020-05-17 00:01:19 +02:00
Iain Buclaw
c9327ac060 fix Issue 20836 - std.math: reorder declarations from most visible to least 2020-05-16 23:57:54 +02:00
Geod24
433c7504c9 Restore accidentally removed import from std.math
It was removed in PR7473.
2020-05-15 23:41:54 +09:00
Iain Buclaw
f68536ba51 std.math: Implement isClose for std.complex types 2020-05-14 13:43:01 +02:00
Iain Buclaw
c71bd19350 std.math: Remove deprecated creal functions
First deprecation was in Jan 2018.

Unittests have been copied across to std.complex where appropirate.
2020-05-13 19:30:02 +02:00
Nicholas Lindsay Wilson
db9b29704e Don't rely on implicit conversion of int to fp for args to intrinsic math functions 2020-04-27 13:49:32 +08:00
Geod24
04f3979317 Replace 'Issue XXX' with Bugzilla links
Make the links clickable, as was done in the DMD repository.
Also avoids any ambiguity w.r.t. where the issue is stored.
2020-04-13 16:28:09 +09:00
Luhrel
643f493ee8 Fix incorrect use of sprintf format 2020-04-09 14:45:47 +02:00
David Abdurachmanov
3d84369f87 Add support for RISC-V 32 & 64 bit
This allows libphobos to compiled on RISC-V targets.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2020-03-28 14:29:49 -07:00
John Colvin
04674ecbe5 move Unqual to right place 2020-02-28 14:02:08 +00:00
John Colvin
a17fb473de allow floatTraits to work with inout 2020-02-28 14:00:05 +00:00
Martin Kinkelin
9c04113936 Fix recent test regressions for targets with double-precision real 2020-02-22 00:36:56 +01:00
Kazuya Takahashi
1f1164932e Add special cases 2020-01-29 22:00:02 +09:00
Kazuya Takahashi
2d726d2dc3 Fix Issue 20542 - std.math.nextafter(NaN, y) and nextafter(x, NaN) should return NaN 2020-01-29 01:10:25 +09:00
Martin Kinkelin
f88116c2a3 bikeshed 2020-01-24 16:17:28 +01:00
Martin Kinkelin
4141cc15ad std.math: Follow-up to #7362
Get rid of redundant version conditions and don't disable whole unittest
blocks (like the extensive exp() tests) just because IEEE flags are
tested too.
2020-01-24 15:50:11 +01:00
Martin Kinkelin
4d98ca2ba8 Hide IEEE flags and FloatingPointControl for soft-float targets 2020-01-24 13:26:43 +07:00
Alexandru Militaru
bb62aaca3d Replaced version (unittest) with version (StdUnittest) to avoid unnecessary overhead when compiling with -unittest 2020-01-19 14:05:17 +02:00
Bernhard Seckinger
357a4df94d Fix Issue 7006 - std.math.pow (integral, integral) crashes on negative exponents 2020-01-03 09:00:46 +01:00
Bernhard Seckinger
1d45910499 Add isClose, a replacement for approxEqual 2019-12-30 13:41:14 +01:00
Bernhard Seckinger
7b9c474521 Fix Issue 5628 - std.math unittest disabled - roundoff error in pow() on SSE2 2019-12-25 09:38:27 +01:00
Bernhard Seckinger
6765bb98ab Fix Issue 19733 - expi documentation links broken 2019-12-06 14:34:09 +01:00
Nathan Sashihara
c62d4c9589 Fix Issue 20198 - Make std.math.nextUp and nextDown and nextafter work in CTFE for float and double 2019-11-24 00:53:25 -08:00
Stian Gulpen
d9db84ad5e prevent cases of illegal implicit convertions in switch 2019-11-24 08:42:33 +01:00
Iain Buclaw
c385950816 std/math.d: Explicitly handle zero and inf in scalbn. 2019-10-19 04:41:16 +02:00
Berni
56c1473f2a Fix issue 20205 - std.math: Wrong result for abs(int.min) 2019-10-06 16:37:04 +02:00
Berni
639f49770c Add unittest to std.math to avoid falling into the trap again. 2019-10-06 14:51:11 +02:00
Sebastian Wilzbach
23fe9b85c1
Revert "Fix issue 20205 - std.math: Wrong result for abs(int.min)" 2019-10-04 12:35:51 +02:00
The Dlang Bot
b36652a3e9
Merge pull request #7180 from crocopaw/approxEqual
Clearer documentation for approxEqual
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-09-26 16:40:20 +02:00
Berni
e6b5c68b4b Fix issue 20205 - std.math: Wrong result for abs(int.min) 2019-09-12 20:57:42 +02:00
The Dlang Bot
ee30e07854
Merge pull request #7177 from n8sh/issue-20199
Fix issues 20199 & 20200: make std.math.frexp & isPowerOf2 work in CTFE
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-09-10 16:48:31 +02:00
The Dlang Bot
1160d7bd39
Merge pull request #7178 from n8sh/issue-20201
Fix Issue 20201 - Make std.math.scalbn pure
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-09-10 09:02:05 +02:00
The Dlang Bot
cd1a9601ff
Merge pull request #7175 from n8sh/issue-20196
Fix Issue 20196 - Make std.math.isNormal work in CTFE
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-09-10 04:38:29 +02:00
Berni
22d4ca5748 Rearrange and add unittests 2019-09-09 21:09:55 +02:00
Berni
16912a3893 Change documentation to make the purpose more clear.
a) Make clear, that fullfilling one criterium is enough
b) Make clear, that the function is not symmetric.
2019-09-09 21:09:55 +02:00