Commit graph

54 commits

Author SHA1 Message Date
Iain Buclaw
ff16d73e4c std.math.exponential: Fix coefficients for log2 and log10 2022-07-05 23:24:50 +00:00
Iain Buclaw
0497537e22 std.math.exponential: Split generic logN implementations to own impl templates 2022-07-05 10:37:31 +02:00
Iain Buclaw
682e16d3ec std.math.exponential: Implement pure logb() for double and float precision 2022-07-04 23:48:56 +00:00
Ast-x64
0c56468d19 RISCV: Fix wrong ExceptionMask values
According to RISCV specifications
https://riscv.org/wp-content/uploads/2019/12/riscv-spec-20191213.pdf,
figure 11.2, the mask flags should be NX, UF, OF, DZ, NV in order.
2022-06-16 20:22:10 +00:00
Ast-x64
b2d5da9c43 Extend floating point precision in some tests
These tests may work better with quadruple-presicion real types now.
2022-06-16 19:53:02 +00:00
Luís Ferreira
a56287dd8b chore(math/exponential): avoid import constants if not InlineAsm_X87
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-05-09 18:44:14 +00:00
Luís Ferreira
19c6e8d251 chore(math/hardware): align spaces by 4 instead of by 3
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-05-09 18:42:23 +00:00
Petar Kirov
dfaaf8fa53 Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-11-09 10:30:28 +02:00
Brian Callahan
8a42656f67 Fix Issue 22416 - Unify polyImpl implementations 2021-10-18 05:40:34 +00:00
Brian Callahan
36eeb42292 OpenBSD: Add polyImpl implementation for x86
Fix Issue 22393 - OpenBSD: Add polyImpl implementation for x86
2021-10-16 08:05:02 -04:00
Per Nordlöw
46d416fa9d Qualify some function parameters under std.format as const to reduce template bloat 2021-09-22 23:12:15 +00:00
Iain Buclaw
1cbbb845af std.math: Reference Issue 5305 in unittest taking pointer to function 2021-08-25 19:27:16 +00:00
Luís Ferreira
62e01fc442
std.math.trigonometry: fix tan asm x86 implementation for ldc compiler
Somehow, separating asm blocks in small pieces produces additional
`mov`s and other instructions on LDC that breaks the tanAsm logic and
therefore returns wrong values.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-08-21 17:29:15 +01:00
Luís Ferreira
8514636059 std.math.algebraic: use fabs from druntime
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-08-19 09:56:55 +00:00
Martin Nowak
3fff60bc50 Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-07-13 12:24:06 +02:00
Walter Bright
13d84801e7 declaring templates inside static foreach is not reliable 2021-06-08 10:57:08 +00:00
The Dlang Bot
19003dd639
Merge pull request #8127 from kinke/bitpattern
[stable] std.math.operations: Slightly revise extractBitpattern()

Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-06-07 18:22:22 +00:00
Martin Kinkelin
06037a25b4 std.math.exponential: Minimally relax a pow() unittest for targets with 64-bit real
Required since #7783.
2021-06-03 07:56:03 +00:00
Martin Kinkelin
8946209a9b Revert #7823 - Faster pow implementation for integral exponents
There are multiple issues with that commit, incl. out-of-bounds read
on x86 systems and a significant performance decrease for qualified
floating-point types; see #8124 for a full list of flaws.

I'm questioning the tackled goal in the first place, because I expect
users to use that `pow` mainly with small integral exponents, *not*
expecting underflows to 0 or overflows to ±infinity, so optimizing
for these cases and sacrificing performance for the regular case doesn't
make a lot of sense to me.
2021-06-03 09:57:57 +09:00
Martin Kinkelin
3d90677e51 std.math.operations: Fix extractBitpattern() unittest 2021-06-02 21:22:27 +02:00
Martin Kinkelin
4d8be9050b std.math.operations: Slightly simplify extractBitpattern() 2021-06-02 20:45:13 +02:00
Martin Kinkelin
5a46c9ecf6 std.math.operations: Make extractBitpattern() @trusted
To enable unsafe reinterpret-casts directly, without extra lambdas.
2021-06-02 20:42:09 +02:00
Martin Kinkelin
ddd044d6c7 std.math.operations: Fix out-of-bounds read in extractBitpattern()
For 32-bit x86 targets with `real.sizeof == 12`.
2021-06-02 20:38:25 +02:00
Martin Kinkelin
a5b66d6614 std.math.hardware: Remove unused InlineAsm_X87* version declarations 2021-05-29 14:50:32 +02:00
Martin Kinkelin
0a685c19ac std.math: Fix missing imports for non-x87 real after split-up 2021-05-29 14:48:17 +02:00
Iain Buclaw
79bf8c3c32 std.math.algebraic: Convert hypot to a template 2021-05-11 12:22:13 +02:00
Iain Buclaw
52699fc020 std.math: Adjust whitespace of a few unittests 2021-05-11 09:14:14 +02:00
Iain Buclaw
543a3d0cd6 std.math.algebraic: Support more float types in hypot 2021-05-11 02:59:57 +02:00
berni44
e53d010def extractBitpattern: Add implied bit to mantissa and subtract bias from exponent. 2021-05-07 09:37:18 +02:00
Razvan Nitu
9909b6ebe3
Merge pull request #8030 from berni44/fixup_7775
Add transition note from approxEqual to isClose.
2021-05-07 15:00:23 +08:00
Nathan Sashihara
efced87ae8 Again use core.math intrinsics instead of std.math wrappers
As in PR #7821 & PR #7825. Mostly changes imports
from std.math being divided into submodules.
2021-05-04 15:59:34 +02:00
berni44
8408ce3108 Add transition note from approxEqual to isClose. 2021-05-03 11:41:44 +02:00
berni44
8d97da17d0 Move bitpattern extraction from std.format to std.math. 2021-04-30 09:37:22 +02:00
Iain Buclaw
1d0da90d82 std.math.exponential: Fix imports for non-INLINE_YL2X path 2021-04-30 02:15:43 +02:00
berni44
661c7a83b1 Clean up std.math.package 2021-04-20 10:04:22 +02:00
berni44
7f42447274 std.math: Move powmod to exponential submodule. 2021-04-20 04:54:59 +02:00
berni44
0c4dcb32a0 Narrow imports in std.math. 2021-04-19 22:32:55 +02:00
berni44
943cf022ea std.math: Move some stranded unittests to correct place. 2021-04-19 18:22:33 +02:00
berni44
4a4af2d78e std.math: Move hardware support into hardware submodule. 2021-04-19 10:46:14 +02:00
berni44
e9014c4342 std.math: Move floating point operations into operations submodule. 2021-04-17 21:52:27 +02:00
Iain Buclaw
7a258f293f std.math.algebraic: Add overload for three-dimensional hypotenuse 2021-04-17 18:13:07 +02:00
berni44
bb2432fdb4 Replace equalsDigit with isClose 2021-04-17 16:59:34 +02:00
berni44
64398c058f std.math: Move exponential functions into exponential submodule. 2021-04-14 16:18:20 +02:00
berni44
9812f41efd std.math: Move introspection functions into submodule. 2021-04-14 14:16:52 +02:00
berni44
66324313a8 Remove std.math.integral. 2021-04-14 14:15:38 +02:00
berni44
a59a058594 std.math: Move floor and ceil to rounding submodule. 2021-04-13 07:47:15 +08:00
berni44
772ef80622 std.math: Move trigonometric functions into submodule. 2021-04-13 07:46:30 +08:00
berni44
59f78a2ae8 std.math: Move pow function into submodule. 2021-04-12 02:43:35 +02:00
berni44
b1f21e8cf6 std.math: Move most of the rounding functions into submodule. 2021-04-12 02:15:35 +02:00
berni44
06a1727565 std.math: Move classic algebraic functions into submodule. 2021-04-07 12:37:35 +02:00