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 Mar 5, 2024
1 parent 08e6e8f commit e26448c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Joris Labie <[email protected]>
Justin Dennison <[email protected]>
Karthik Prakash <[email protected]>
Khaldon <[email protected]>
Lovelin <[email protected]>
Marcus Fantham <[email protected]>
Matt Cochrane <[email protected]>
Mihir Pandit <[email protected]>
Expand All @@ -44,6 +45,7 @@ Prajwal Kulkarni <[email protected]>
Pranav Goswami <[email protected]>
Praneki <[email protected]>
Pratik <[email protected]>
Priyansh <[email protected]>
Rejoan Sardar <[email protected]>
Ricky Reusser <[email protected]>
Robert Gislason <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion base/special/ceiln/examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "stdlib/math/base/special/ceiln.h"
#include <stdio.h>

int main() {
int main( void ) {
const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 };

double y;
Expand Down
6 changes: 3 additions & 3 deletions base/special/ceiln/src/ceiln.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// VARIABLES //

static const double MAX_INT = STDLIB_CONSTANT_FLOAT64_MAX_SAFE_INTEGER + 1.0;
static const double HUGE = 1.0e+308;
static const double HUGE_VALUE = 1.0e+308;


// MAIN //
Expand Down Expand Up @@ -91,11 +91,11 @@ double stdlib_base_ceiln( const double x, const int32_t n ) {
// If we overflow, return `x`, as the number of digits to the right of the decimal is too small (i.e., `x` is too large / lacks sufficient fractional precision) for there to be any effect when rounding...
if ( n < STDLIB_CONSTANT_FLOAT64_MIN_BASE10_EXPONENT ) {
s = pow( 10.0, -( n + STDLIB_CONSTANT_FLOAT64_MAX_BASE10_EXPONENT ) ); // TODO: replace use of `pow` once have stdlib equivalent
y = ( x * HUGE ) * s; // order of operation matters!
y = ( x * HUGE_VALUE ) * s; // order of operation matters!
if ( stdlib_base_is_infinite( y ) ) {
return x;
}
return ( stdlib_base_ceil( y ) / HUGE ) / s;
return ( stdlib_base_ceil( y ) / HUGE_VALUE ) / s;
}
s = pow( 10.0, -n ); // TODO: replace use of `pow` once have stdlib equivalent
y = x * s;
Expand Down
2 changes: 1 addition & 1 deletion base/special/floorn/examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "stdlib/math/base/special/floorn.h"
#include <stdio.h>

int main() {
int main( void ) {
const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 };

double y;
Expand Down
6 changes: 3 additions & 3 deletions base/special/floorn/src/floorn.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// VARIABLES //

static const double MAX_INT = STDLIB_CONSTANT_FLOAT64_MAX_SAFE_INTEGER + 1.0;
static const double HUGE = 1.0e+308;
static const double HUGE_VALUE = 1.0e+308;


// MAIN //
Expand Down Expand Up @@ -134,11 +134,11 @@ double stdlib_base_floorn( const double x, const int32_t n ) {
// If we overflow, return `x`, as the number of digits to the right of the decimal is too small (i.e., `x` is too large / lacks sufficient fractional precision) for there to be any effect when rounding...
if ( n < STDLIB_CONSTANT_FLOAT64_MIN_BASE10_EXPONENT ) {
s = pow( 10.0, - ( n + STDLIB_CONSTANT_FLOAT64_MAX_BASE10_EXPONENT ) ); // TODO: replace use of `pow` once have stdlib equivalent
y = ( x * HUGE ) * s; // order of operation matters!
y = ( x * HUGE_VALUE ) * s; // order of operation matters!
if ( stdlib_base_is_infinite( y ) ) {
return x;
}
return ( stdlib_base_floor( y ) / HUGE ) / s;
return ( stdlib_base_floor( y ) / HUGE_VALUE ) / s;
}
s = pow( 10.0, -n ); // TODO: replace use of `pow` once have stdlib equivalent
y = x * s;
Expand Down
3 changes: 2 additions & 1 deletion base/special/min/examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "stdlib/math/base/special/min.h"
#include <stdlib.h>
#include <stdio.h>

int main( void ) {
Expand All @@ -31,4 +32,4 @@ int main( void ) {
v = stdlib_base_min( x, y );
printf( "x: %lf, y: %lf, min(x, y): %lf\n", x, y, v );
}
}
}
3 changes: 2 additions & 1 deletion base/special/minabs/examples/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "stdlib/math/base/special/minabs.h"
#include <stdlib.h>
#include <stdio.h>

int main( void ) {
Expand All @@ -31,4 +32,4 @@ int main( void ) {
v = stdlib_base_minabs( x, y );
printf( "x: %lf, y: %lf, minabs(x, y): %lf\n", x, y, v );
}
}
}

0 comments on commit e26448c

Please sign in to comment.