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: add constants/float32/min-base10-exponent #3092

Merged

Conversation

gururaj1512
Copy link
Contributor

@gururaj1512 gururaj1512 commented Nov 10, 2024

Resolves None.

This pull request:

  • Adds implementaion of constants/float32/min-base10-exponent
var FLOAT32_MIN_BASE10_EXPONENT = require( '@stdlib/constants/float32/min-base10-exponent' );

console.log( FLOAT32_MIN_BASE10_EXPONENT );
// => -38

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@gururaj1512 gururaj1512 changed the title feat: add constants/float32/max-base10-exponent feat: add constants/float32/mix-base10-exponent Nov 10, 2024
@gururaj1512 gururaj1512 changed the title feat: add constants/float32/mix-base10-exponent feat: add constants/float32/min-base10-exponent Nov 10, 2024
@Planeshifter
Copy link
Member

Planeshifter commented Nov 10, 2024

@gururaj1512 In the C standard library, the FLT_MIN_10_EXP macro for the minimum base 10 exponent for a normal single-precision floating-point number is defined as -37.
While the smallest positive normal single-precision floating-point number has a base 10 exponent of -38 (~1.17549435e-38), standard libraries define the minimum base 10 exponent as -37 to ensure that any number greater than or equal to 10^{-37} is representable as a normal float. We should use this value instead, as it is the widely accepted and used one in various programming languages.

References:

Signed-off-by: Philipp Burckhardt <[email protected]>
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and update, @gururaj1512!

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Nov 11, 2024
@stdlib-bot
Copy link
Contributor

PR Commit Message

feat: add `constants/float32/min-base10-exponent`

PR-URL: https://github.com/stdlib-js/stdlib/pull/3092

Co-authored-by: Gururaj Gurram <[email protected]>
Co-authored-by: Philipp Burckhardt <[email protected]>
Reviewed-by: Philipp Burckhardt <[email protected]>
Signed-off-by: Philipp Burckhardt <[email protected]>

Please review the above commit message and make any necessary adjustments.

@Planeshifter Planeshifter merged commit 824d519 into stdlib-js:develop Nov 11, 2024
16 checks passed
@gururaj1512 gururaj1512 deleted the float32-min-base10-exponent branch November 11, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready To Merge A pull request which is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants