stdlib: [BUG]: C implementation for `stats/base/dists/kumaraswamy/median` has different results than the JavaScript implementation

Description

Pointed out by @Neerajpathak07 and @yuvi-mittal

For context, see comment

When running native tests for stats/base/dists/kumaraswamy/median, the majority of tests fail because the C implementation is generalized for a single value of a = 1.0 rather than any positive number.

The fix is to change

https://github.com/stdlib-js/stdlib/blob/367ec2c5fe4a11f2e9a450ab4b21ea66db002cc2/lib/node_modules/%40stdlib/stats/base/dists/kumaraswamy/median/src/main.c#L42

to:

return stdlib_base_pow( 1.0 - stdlib_base_pow( 2.0, -1.0 / b ), 1.0 / a );

Related Issues

None

Questions

No.

Demo

No response

Reproduction

- Run `make install-node-addons NODE_ADDONS_PATTERN="stats/base/dists/kumaraswamy/median"`
- Run `make test TESTS_FILTER=".*/stats/base/dists/kumaraswamy/median/test/test.native.js"`

Expected Results

total:     1009
passing:   1009

Actual Results

total:     1009
passing:   27
failing:   982

Version

No response

Environments

N/A

Browser Version

No response

Node.js / npm Version

No response

Platform

No response

Checklist

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@Neerajpathak07, do you want to proceed with a PR targeting this issue?

Ig @yuvi-mittal has started working upon it after I pointed out what was wrong.

@Krishna-Sharma-g, when creating a PR, please also consider the points mentioned by Athan in the discussions here and here.

Here is a reference PR to confirm whether you are on the right track: https://github.com/stdlib-js/stdlib/pull/3354

@Krishna-Sharma-g , You can open a PR , no worries . The goal is to get work done as fast as possible.

I have already started working on it , and i have been checking rest of the distributions too , there are few test cases more that are failing , will raise a PR soon.

Also, the tests in test.native.js still don’t fully match what is in test.js.

There were a lot of issues with the PR adding the C implementation which were missed during code review. See https://github.com/stdlib-js/stdlib/commit/fc5df1769306302648f8ed492455558447c47d8f. Someone should take a close look at that package to determine whether everything is correct.

cc @Planeshifter