-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add number/float16/base/add
#9442
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
base: develop
Are you sure you want to change the base?
feat: add number/float16/base/add
#9442
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
Signed-off-by: Neeraj Pathak <[email protected]>
|
/stdlib update-copyright-years |
lib/node_modules/@stdlib/number/float16/base/add/benchmark/benchmark.native.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/number/float16/base/add/examples/c/example.c
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/number/float16/base/add/examples/index.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/number/float16/base/add/test/test.native.js
Outdated
Show resolved
Hide resolved
|
@gururaj1512 Thanks for reviewing and flagging changes although I do have a few conflicting opinions on the description of examples!! |
Signed-off-by: Athan <[email protected]>
lib/node_modules/@stdlib/number/float16/base/add/examples/index.js
Outdated
Show resolved
Hide resolved
Signed-off-by: Athan <[email protected]>
lib/node_modules/@stdlib/number/float16/base/add/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
Signed-off-by: Athan <[email protected]>
| double elapsed; | ||
| stdlib_float16_t z; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| double elapsed; | |
| stdlib_float16_t z; | |
| stdlib_float16_t z; | |
| double elapsed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order by length.
| t = tic(); | ||
| for ( i = 0; i < ITERATIONS; i++ ) { | ||
| z = stdlib_base_float16_add( x[ i%100 ], y[ i%100 ] ); | ||
| if ( z != z ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work the way you need it to. You need to compare against the bit sequence value for NaN. We do this in other benchmarks for float16.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better would be to use the eventual number/float16/base/assert/is-nan utility here.
| ] | ||
| } | ||
| ], | ||
| "output_policy": "same", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "output_policy": "same", |
We can remove this, as this particular field was later found to be unnecessary at this level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Neerajpathak07 We should go ahead and add the binary macro for half-precision HH_H. Would you mind opening a PR for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah will do it
| // MODULES // | ||
|
|
||
| var tape = require( 'tape' ); | ||
| var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should go ahead and create a half-precision utility for this at number/float16/base/assert/is-negative-zero. Same thing for is-positive-zero and is-nan.
We'll eventually be moving math/base/assert/is-negative-zero to number/float64/base/assert/is-negative-zero, so we might as well go ahead and pre-emptively add the half-precision utilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add a PR soon for that!!
|
|
||
| var resolve = require( 'path' ).resolve; | ||
| var tape = require( 'tape' ); | ||
| var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
kgryte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial comments.
|
Will draft this PR for the time being till we add the macro and the utilities!! |
Resolves none.
Description
This pull request:
number/float16/base/addRelated Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers