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 Dec 23, 2024
1 parent 4010d2e commit 40acf17
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 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-12-21)
## Unreleased (2024-12-23)

<section class="reverts">

Expand All @@ -22,6 +22,7 @@

<details>

- [`6a0d6b8`](https://github.com/stdlib-js/stdlib/commit/6a0d6b861f8e2079a501ca4e46a9175440eedb46) - **style:** update to use tabs for indentation _(by Philipp Burckhardt)_
- [`f13ddb2`](https://github.com/stdlib-js/stdlib/commit/f13ddb2eb01e5520b6fa98634bbf9de76793036f) - **style:** use spaces for alignment in C comments _(by Philipp Burckhardt)_
- [`b0e68c5`](https://github.com/stdlib-js/stdlib/commit/b0e68c5bc8ee985794eb2ea1791c9337cd15fbd0) - **chore:** update to modern benchmark Makefile _(by Philipp Burckhardt)_
- [`d8a4cfb`](https://github.com/stdlib-js/stdlib/commit/d8a4cfb578a949ed07c7a18749e48096f4f9b488) - **revert:** chore: update to modern benchmark Makefile _(by Philipp Burckhardt)_
Expand Down
16 changes: 8 additions & 8 deletions examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#include <stdio.h>

int main( void ) {
double x;
double v;
int i;
double x;
double v;
int i;

for ( i = 0; i < 100; i++ ) {
x = (double)rand() / (double)RAND_MAX;
v = stdlib_base_logit( x );
printf( "logit(%lf) = %lf\n", x, v );
}
for ( i = 0; i < 100; i++ ) {
x = (double)rand() / (double)RAND_MAX;
v = stdlib_base_logit( x );
printf( "logit(%lf) = %lf\n", x, v );
}
}
26 changes: 13 additions & 13 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
* // returns ~-1.386
*/
double stdlib_base_logit( const double p ) {
if ( stdlib_base_is_nan( p ) ) {
return 0.0 / 0.0; // NaN
}
if ( !stdlib_base_is_probability( p ) ) {
return 0.0 / 0.0; // NaN
}
if ( p == 0.0 ) {
return STDLIB_CONSTANT_FLOAT64_NINF;
}
if ( p == 1.0 ) {
return STDLIB_CONSTANT_FLOAT64_PINF;
}
return stdlib_base_ln( p / ( 1.0 - p ) );
if ( stdlib_base_is_nan( p ) ) {
return 0.0 / 0.0; // NaN
}
if ( !stdlib_base_is_probability( p ) ) {
return 0.0 / 0.0; // NaN
}
if ( p == 0.0 ) {
return STDLIB_CONSTANT_FLOAT64_NINF;
}
if ( p == 1.0 ) {
return STDLIB_CONSTANT_FLOAT64_PINF;
}
return stdlib_base_ln( p / ( 1.0 - p ) );
}

0 comments on commit 40acf17

Please sign in to comment.