Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stats): add C implementation for stats/base/dists/arcsine/mode #4236

Merged
merged 18 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: address requested changes in PR for arcsine mode C implementation
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: na
  - task: run_c_examples
    status: na
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: na
  - task: run_c_benchmarks
    status: na
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: na
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: na
---
  • Loading branch information
anandkaranubc committed Dec 29, 2024
commit de7fc558b2006b06540083dcdda099d93c916629
Original file line number Diff line number Diff line change
@@ -38,11 +38,8 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/math/base/napi/ternary",
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/special/asin",
"@stdlib/math/base/special/sqrt",
"@stdlib/constants/float64/pi"
"@stdlib/math/base/napi/binary",
"@stdlib/math/base/assert/is-nan"
]
},
{
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@
#include "stdlib/stats/base/dists/arcsine/mode.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
@@ -41,11 +40,7 @@ int main( void ) {
b = random_uniform( a, a + 40.0 );
m = stdlib_base_dists_arcsine_mode( a, b );

if ( isnan( m ) ) {
printf( "a: %lf, b: %lf, Mode: NaN (Invalid Input)\n", a, b );
} else {
printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m );
}
printf( "a: %lf, b: %lf, Mode: %lf\n", a, b, m );
}

return 0;
Original file line number Diff line number Diff line change
@@ -16,8 +16,6 @@
* limitations under the License.
*/

#include <math.h>
#include <stdbool.h>
#include "stdlib/math/base/assert/is_nan.h"

/**
@@ -57,7 +55,7 @@ double stdlib_base_dists_arcsine_mode( const double a, const double b ) {
stdlib_base_is_nan( b ) ||
a >= b
) {
return NAN;
return 0.0/0.0; // NaN
}
return a;
}