1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 16:08:35 +02:00
Files
archived-php-src/ext
Tim Düsterhus 582b724c35 random: Fix γ-section implementation for Randomizer::getFloat() (#12402)
The reference implementation of the "Drawing Random Floating-Point Numbers from
an Interval" paper contains two mistakes that will result in erroneous values
being returned under certain circumstances:

- For large values of `g` the multiplication of `k * g` might overflow to
  infinity.
- The value of `ceilint()` might exceed 2^53, possibly leading to a rounding
  error when promoting `k` to double within the multiplication of `k * g`.

This commit updates the implementation based on Prof. Goualard suggestions
after reaching out to him. It will correctly handle inputs larger than 2^-1020
in absolute values. This limitation will be documented and those inputs
possibly be rejected in a follow-up commit depending on performance concerns.
2023-10-13 17:55:14 +02:00
..
2023-09-26 21:44:00 +02:00
2023-08-10 15:52:21 +02:00
2023-10-09 22:12:05 +02:00
2023-04-03 08:02:19 +02:00
2023-07-07 18:01:53 +02:00
2023-09-16 21:28:24 +02:00
2023-08-19 23:11:23 +01:00
2023-07-10 13:42:44 +02:00
2023-09-23 20:12:56 +01:00
2023-07-18 12:59:21 +02:00
2023-08-17 18:46:28 +01:00
2023-09-22 10:26:10 +02:00
2023-09-18 20:14:47 +02:00
2023-03-28 00:12:28 +02:00
2023-04-03 08:02:19 +02:00
2023-08-23 21:20:41 +02:00
2023-07-31 15:18:13 +02:00
2023-04-03 08:02:19 +02:00
2023-05-26 11:39:56 +02:00
2023-10-11 17:27:54 +02:00
2023-09-09 20:00:01 +02:00
2023-09-21 19:52:21 +02:00
2023-07-31 20:15:51 -05:00
2023-09-30 00:11:31 +02:00
2023-09-12 11:18:18 +02:00
2023-08-09 14:06:36 +02:00