-
-
Notifications
You must be signed in to change notification settings - Fork 957
feat: add number/float16/base/to-word
#8371
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/to-word
#8371
Conversation
|
/stdlib update-copyright-years |
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
/stdlib merge |
|
|
||
| #### toWord( x ) | ||
|
|
||
| Returns an unsigned 16-bit `integer` corresponding to the [IEEE 754][ieee754] binary representation of a [half-precision floating-point number][ieee754]. |
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.
| Returns an unsigned 16-bit `integer` corresponding to the [IEEE 754][ieee754] binary representation of a [half-precision floating-point number][ieee754]. | |
| Returns an unsigned 16-bit integer corresponding to the [IEEE 754][ieee754] binary representation of a [half-precision floating-point number][ieee754]. |
|
|
||
| b.tic(); | ||
| for ( i = 0; i < b.iterations; i++ ) { | ||
| x = ( randu()*1.0e7 ) - 5.0e6; |
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.
@gururaj1512 Would you mind updating this file to use random/array/uniform and x[ i%x.length ], so that we can avoid PRNG generation within the hot loop?
| Parameters | ||
| ---------- | ||
| x: float | ||
| half-precision floating-point number. |
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.
| half-precision floating-point number. | |
| Half-precision floating-point number. |
|
|
||
| Parameters | ||
| ---------- | ||
| x: float |
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.
| x: float | |
| x: number |
| * limitations under the License. | ||
| */ | ||
|
|
||
| import toWordf = require( './index' ); |
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.
s/toWordf/toWord/ here and below.
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.
@gururaj1512 Did you test whether this generated the same results as the current "main" implementation?
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.
@kgryte Yaa, I have tested this implementation, and this is working as intended
Resolves None.
Description
This pull request:
number/float16/base/to-wordRelated Issues
This pull request has the following related issues:
number/float64/base/to-float16#8207 to be mergedQuestions
No.
Other
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
Got the first draft of code and basic understanding by consulting ChatGPT and claude.ai. But studied the implementation from various resources
@stdlib-js/reviewers