Skip to content

Commit ac8023f

Browse files
committed
Auto-generated commit
1 parent 79a6ade commit ac8023f

5 files changed

Lines changed: 30 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-06-22)
7+
## Unreleased (2025-06-24)
88

99
<section class="features">
1010

@@ -527,6 +527,7 @@ A total of 49 issues were closed in this release:
527527

528528
<details>
529529

530+
- [`7cd0373`](https://github.com/stdlib-js/stdlib/commit/7cd03736a4c79cf5fff04bb84c97c458f987f4c6) - **bench:** fix function name and use `random_uniform` _(by Karan Anand)_
530531
- [`0e13713`](https://github.com/stdlib-js/stdlib/commit/0e13713f19e808617d4bff6b51af0d9ae6802e20) - **chore:** fix C lint errors [(#7370)](https://github.com/stdlib-js/stdlib/pull/7370) _(by zhanggy)_
531532
- [`3e45add`](https://github.com/stdlib-js/stdlib/commit/3e45adda10132ea8f55ad60c1504c8fd19b0841d) - **chore:** address commit comments for commit `6b1c190` [(#7431)](https://github.com/stdlib-js/stdlib/pull/7431) _(by Lokesh Ranjan)_
532533
- [`f63f8df`](https://github.com/stdlib-js/stdlib/commit/f63f8df9abf7a7ddf9de4e895a64e4699d2f378b) - **style:** remove header section comments from C files _(by Philipp Burckhardt)_

CONTRIBUTORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Bryan Elee <rxbryn@gmail.com>
3737
Chinmay Joshi <86140365+JawHawk@users.noreply.github.com>
3838
Christopher Dambamuromo <chridam@gmail.com>
3939
Dan Rose <danoftheroses@gmail.com>
40+
Daniel Hernandez Gomez <156333015+dhernandeez13@users.noreply.github.com>
4041
Daniel Killenberger <daniel.killenberger@gmail.com>
4142
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
4243
Debashis Maharana <debashismaharana7854@gmail.com>
@@ -63,6 +64,7 @@ Girish Garg <garggirish2020@gmail.com>
6364
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
6465
Gunj Joshi <gunjjoshi8372@gmail.com>
6566
Gururaj Gurram <gururajgurram1512@gmail.com>
67+
Harishchandra Reddy <harish.7000@gmail.com>
6668
Haroon Rasheed <51189276+haroon26@users.noreply.github.com>
6769
Harsh <harshyadav6078@gmail.com>
6870
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
@@ -201,6 +203,7 @@ ditsu <170345142+ditsus@users.noreply.github.com>
201203
ekambains <bainsinbusiness@gmail.com>
202204
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
203205
iraandrushko <71790513+iraandrushko@users.noreply.github.com>
206+
jsai28 <54253219+jsai28@users.noreply.github.com>
204207
lohithganni <116790357+lohithganni@users.noreply.github.com>
205208
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
206209
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>

base/special/round/benchmark/c/benchmark.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ static double tic( void ) {
7474
}
7575

7676
/**
77-
* Generates a random number on the interval [0,1).
77+
* Generates a random number on the interval [min,max).
7878
*
79-
* @return random number
79+
* @param min minimum value (inclusive)
80+
* @param max maximum value (exclusive)
81+
* @return random number
8082
*/
81-
static double rand_double( void ) {
82-
int r = rand();
83-
return (double)r / ( (double)RAND_MAX + 1.0 );
83+
static double random_uniform( const double min, const double max ) {
84+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
85+
return min + ( v*(max-min) );
8486
}
8587

8688
/**
@@ -96,7 +98,7 @@ static double benchmark( void ) {
9698
int i;
9799

98100
for ( i = 0; i < 100; i++ ) {
99-
x[ i ] = ( 1000.0 * rand_double() ) - 500.0;
101+
x[ i ] = random_uniform( -500.0, 500.0 );;
100102
}
101103

102104
t = tic();

base/special/round/benchmark/c/cephes/benchmark.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@ static double tic( void ) {
7979
}
8080

8181
/**
82-
* Generates a random number on the interval [0,1).
82+
* Generates a random number on the interval [min,max).
8383
*
84-
* @return random number
84+
* @param min minimum value (inclusive)
85+
* @param max maximum value (exclusive)
86+
* @return random number
8587
*/
86-
static double rand_double( void ) {
87-
int r = rand();
88-
return (double)r / ( (double)RAND_MAX + 1.0 );
88+
static double random_uniform( const double min, const double max ) {
89+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
90+
return min + ( v*(max-min) );
8991
}
9092

9193
/**
@@ -101,7 +103,7 @@ static double benchmark( void ) {
101103
int i;
102104

103105
for ( i = 0; i < 100; i++ ) {
104-
x[ i ] = ( 1000.0 * rand_double() ) - 500.0;
106+
x[ i ] = random_uniform( -500.0, 500.0 );
105107
}
106108

107109
t = tic();

base/special/round/benchmark/c/native/benchmark.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ static double tic( void ) {
7575
}
7676

7777
/**
78-
* Generates a random number on the interval [0,1).
78+
* Generates a random number on the interval [min,max).
7979
*
80-
* @return random number
80+
* @param min minimum value (inclusive)
81+
* @param max maximum value (exclusive)
82+
* @return random number
8183
*/
82-
static double rand_double( void ) {
83-
int r = rand();
84-
return (double)r / ( (double)RAND_MAX + 1.0 );
84+
static double random_uniform( const double min, const double max ) {
85+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
86+
return min + ( v*(max-min) );
8587
}
8688

8789
/**
@@ -97,12 +99,12 @@ static double benchmark( void ) {
9799
int i;
98100

99101
for ( i = 0; i < 100; i++ ) {
100-
x[ i ] = ( 1000.0 * rand_double() ) - 500.0;
102+
x[ i ] = random_uniform( -500.0, 500.0 );
101103
}
102104

103105
t = tic();
104106
for ( i = 0; i < ITERATIONS; i++ ) {
105-
y = round( x[ i % 100 ] );
107+
y = stdlib_base_round( x[ i % 100 ] );
106108
if ( y != y ) {
107109
printf( "should not return NaN\n" );
108110
break;

0 commit comments

Comments
 (0)