|
17 | 17 | */
|
18 | 18 |
|
19 | 19 | #include "stdlib/math/base/special/gcd.h"
|
| 20 | +#include "stdlib/math/base/special/fmod.h" |
20 | 21 | #include "stdlib/math/base/assert/is_nan.h"
|
21 | 22 | #include "stdlib/math/base/assert/is_integer.h"
|
22 | 23 | #include "stdlib/constants/float64/pinf.h"
|
23 | 24 | #include "stdlib//constants/float64/ninf.h"
|
24 | 25 | #include <stdint.h>
|
25 |
| -#include <math.h> |
26 | 26 |
|
27 | 27 | // 2^63 - 1
|
28 | 28 | static const int64_t STDLIB_CONSTANT_INT64_MAX = 9223372036854775807;
|
@@ -56,19 +56,19 @@ static double largeIntegers( const double a, const double b ) {
|
56 | 56 | k = 1.0;
|
57 | 57 |
|
58 | 58 | // Reduce `a` and/or `b` to odd numbers and keep track of the greatest power of 2 dividing both `a` and `b`...
|
59 |
| - while ( fmod( ac, 2.0 ) == 0.0 && fmod( bc, 2.0 ) == 0.0 ) { |
| 59 | + while ( stdlib_base_fmod( ac, 2.0 ) == 0.0 && stdlib_base_fmod( bc, 2.0 ) == 0.0 ) { |
60 | 60 | ac /= 2.0; // right shift
|
61 | 61 | bc /= 2.0; // right shift
|
62 | 62 | k *= 2.0; // left shift
|
63 | 63 | }
|
64 | 64 | // Reduce `a` to an odd number...
|
65 |
| - while ( fmod( ac, 2.0 ) == 0.0 ) { |
| 65 | + while ( stdlib_base_fmod( ac, 2.0 ) == 0.0 ) { |
66 | 66 | ac /= 2.0; // right shift
|
67 | 67 | }
|
68 | 68 | // Henceforth, `a` is always odd...
|
69 | 69 | while ( bc ) {
|
70 | 70 | // Remove all factors of 2 in `b`, as they are not common...
|
71 |
| - while ( fmod( bc, 2.0 ) == 0.0 ) { |
| 71 | + while ( stdlib_base_fmod( bc, 2.0 ) == 0.0 ) { |
72 | 72 | bc /= 2.0; // right shift
|
73 | 73 | }
|
74 | 74 | // `a` and `b` are both odd. Swap values such that `b` is the larger of the two values, and then set `b` to the difference (which is even)...
|
|
0 commit comments