Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav <85227306+Pranavchiku@users.noreply.github.com>
  • Loading branch information
Pranavchiku authored Mar 3, 2024
1 parent 3414cca commit c834fd6
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ for ( i = 0; i < 100; i++ ) {

#### stdlib_base_is_even( x )

Test if a finite numeric value is an even number.
Tests if a finite numeric value is an even number.

```c
bool out = stdlib_base_is_even( 1.0 );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2022 The Stdlib Authors.
# Copyright (c) 2024 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ double benchmark() {

t = tic();
for ( i = 0; i < ITERATIONS; i++ ) {
x = ( rand_double() * 100.0 );
x = ( rand_double() * 200.0 ) - 100.0;
b = stdlib_base_is_even( x );
if ( b != true && b != false ) {
printf( "should return either true or false\n" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ int main( void ) {
for ( i = 0; i < 100; i++ ) {
x = ( ( (double)rand() / (double)RAND_MAX ) * 100.0 );
v = stdlib_base_is_even( x );
printf( "x = %lf, is_even(x) = %s\n", x, ( v ) ? "true" : "false" );
printf( "x = %lf, is_even(x) = %s\n", x, ( v ) ? "even" : "not even" );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extern "C" {
#endif

/**
* Test if a finite numeric value is an even number.
* Tests if a finite numeric value is an even number.
*/
bool stdlib_base_is_even( const double x );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var addon = require( './../src/addon.node' );
// MAIN //

/**
* Test if a finite numeric value is an even number.
* Tests if a finite numeric value is an even number.
*
* @private
* @param {number} x - value to test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
* // returns false
*/
bool stdlib_base_is_even( const double x ) {
return ( stdlib_base_is_integer ( x/2.0 ) );
return stdlib_base_is_integer( x/2.0 );
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var randu = require( '@stdlib/random/base/randu' );
var round = require( '@stdlib/math/base/special/round' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand All @@ -45,7 +45,7 @@ tape( 'main export is a function', opts, function test( t ) {
t.end();
});

tape( 'the function returns `true` if provided an even number', function test( t ) {
tape( 'the function returns `true` if provided an even number', opts, function test( t ) {
var bool;
var x;
var i;
Expand Down

0 comments on commit c834fd6

Please sign in to comment.