Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Aug 29, 2024
1 parent 7c88dd4 commit 4236c15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<section class="release" id="unreleased">

## Unreleased (2024-08-24)
## Unreleased (2024-08-29)

<section class="packages">

Expand Down Expand Up @@ -166,6 +166,7 @@ A total of 3 people contributed to this release. Thank you to the following cont

<details>

- [`1288e7e`](https://github.com/stdlib-js/stdlib/commit/1288e7e8b4bf92af109871d4e75c91e707449575) - **refactor:** use `stdlib_base_fmod` instead of built-in in `math/base/special/gcd` _(by Gunj Joshi)_
- [`0ab9fc7`](https://github.com/stdlib-js/stdlib/commit/0ab9fc7de86012c670189711b6c6627b41119537) - **test:** add and modify tests [(#2830)](https://github.com/stdlib-js/stdlib/pull/2830) _(by Gunj Joshi)_
- [`16c19b6`](https://github.com/stdlib-js/stdlib/commit/16c19b67c7452b3ae9755cc7ef2a5d2540ab1cf9) - **feat:** add `math/base/special/xlogyf` [(#2813)](https://github.com/stdlib-js/stdlib/pull/2813) _(by Gunj Joshi)_
- [`71c43cf`](https://github.com/stdlib-js/stdlib/commit/71c43cf5165749e2ce2647cb52d92f6c97f16959) - **feat:** add `math/base/special/ldexpf` _(by Gunj Joshi, Philipp Burckhardt)_
Expand Down
3 changes: 3 additions & 0 deletions base/special/gcd/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"dependencies": [
"@stdlib/math/base/napi/binary",
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/special/fmod",
"@stdlib/math/base/assert/is-integer",
"@stdlib/constants/float64/pinf",
"@stdlib/constants/float64/ninf"
Expand All @@ -55,6 +56,7 @@
"libpath": [],
"dependencies": [
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/special/fmod",
"@stdlib/math/base/assert/is-integer",
"@stdlib/constants/float64/pinf",
"@stdlib/constants/float64/ninf"
Expand All @@ -72,6 +74,7 @@
"libpath": [],
"dependencies": [
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/special/fmod",
"@stdlib/math/base/assert/is-integer",
"@stdlib/constants/float64/pinf",
"@stdlib/constants/float64/ninf"
Expand Down
8 changes: 4 additions & 4 deletions base/special/gcd/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
*/

#include "stdlib/math/base/special/gcd.h"
#include "stdlib/math/base/special/fmod.h"
#include "stdlib/math/base/assert/is_nan.h"
#include "stdlib/math/base/assert/is_integer.h"
#include "stdlib/constants/float64/pinf.h"
#include "stdlib//constants/float64/ninf.h"
#include <stdint.h>
#include <math.h>

// 2^63 - 1
static const int64_t STDLIB_CONSTANT_INT64_MAX = 9223372036854775807;
Expand Down Expand Up @@ -56,19 +56,19 @@ static double largeIntegers( const double a, const double b ) {
k = 1.0;

// Reduce `a` and/or `b` to odd numbers and keep track of the greatest power of 2 dividing both `a` and `b`...
while ( fmod( ac, 2.0 ) == 0.0 && fmod( bc, 2.0 ) == 0.0 ) {
while ( stdlib_base_fmod( ac, 2.0 ) == 0.0 && stdlib_base_fmod( bc, 2.0 ) == 0.0 ) {
ac /= 2.0; // right shift
bc /= 2.0; // right shift
k *= 2.0; // left shift
}
// Reduce `a` to an odd number...
while ( fmod( ac, 2.0 ) == 0.0 ) {
while ( stdlib_base_fmod( ac, 2.0 ) == 0.0 ) {
ac /= 2.0; // right shift
}
// Henceforth, `a` is always odd...
while ( bc ) {
// Remove all factors of 2 in `b`, as they are not common...
while ( fmod( bc, 2.0 ) == 0.0 ) {
while ( stdlib_base_fmod( bc, 2.0 ) == 0.0 ) {
bc /= 2.0; // right shift
}
// `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)...
Expand Down

0 comments on commit 4236c15

Please sign in to comment.