[RFC]: add support for serializing a number to a string while avoiding exponential notation #581
Open
3 tasks done
Labels
difficulty: 3
Likely to be challenging but manageable.
Feature
Issue or pull request for adding a new feature.
JavaScript
Issue involves or relates to JavaScript.
Needs Discussion
Needs further discussion.
priority: Normal
Normal priority concern or feature request.
RFC
Request for comments. Feature requests and proposed changes.
Utilities
Issue or pull request concerning general utilities.
Description
This RFC proposes serializing a number to string while avoiding exponential notation.
The default behavior for JavaScript runtimes when serializing either very large (>=10^21) or very small (<10^-6) numbers to a string is to convert them to exponential notation. E.g.,
However, in certain circumstances, you may want to avoid serializing to exponential notation and may prefer printing all digits (e.g., see discussion).
For example, the following may be desirable behavior
This RFC proposes to add support for such behavior.
Package:
@stdlib/number/to-string
(?)alias:
number2string
Related Issues
No.
Questions
Built-in
Number.prototype.toString( [radix] )
supports an optionalradix
argument. The proposed API would also support this argument, but also support an options object.Questions:
Other
Prior art:
Checklist
RFC:
.The text was updated successfully, but these errors were encountered: