Ability to represent floating point numbers
See original GitHub issueOverview
At the moment we have (using a Python as a platform example but it’s similar in other languages):
integer
->int
(Python)number
->decimal.Decimal
(Python) - guaranteed to have 100% precision
We don’t have a type to represent numbers when it’s ok to lose some precision in favor of calculation speed. Decimals are really slow in Python/JavaScript/etc
Here is a root issue with benchmarking - https://github.com/frictionlessdata/frictionless-py/issues/461
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Floating-point arithmetic - Wikipedia
A floating-point system can be used to represent, with a fixed number of digits, numbers of very different orders of magnitude — such...
Read more >Representing Floating Point Numbers
Eight digits are used to represent a floating point number : two for the exponent and six for the mantissa. The sign of...
Read more >Floating Point Representation - Basics - GeeksforGeeks
Accuracy in floating point representation is governed by number of significant bits, whereas range is limited by exponent. Not all real numbers ......
Read more >4.8. Floating Point Numbers — CS160 Reader - Chemeketa CS
We are considering a simple example of how floating-point numbers work - real systems have a few extra details like special values to...
Read more >Floating Point Number - an overview | ScienceDirect Topics
Floating point numbers are used to represent noninteger fractional numbers and are used in most engineering and technical calculations, for example, 3.256, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@roll i’d prefer doing the simplest thing possible at present and use
format
on number and have a small set of recommended supported values e.g. the classicfloat, double
etc but allow given community to add whatever agreed values they want. You could even hack decimal places into this to start with by doingdecimalPlaces2, decimalPlaces3
etc.@roll i’m happy with you to run with a recommendation on this one and trial into the frictionless framework and if you have something working well for us to “standardize” as it were.
We may be trying to solve too many problems at once here, and there may be a reason so many standards just avoid dealing with this problem, but that doesn’t exactly help people who need to represent something specific like currency that has two decimal places. If we wanted to just address the decimal problem, it could be with a new constraint of
scale
or something similar. IEmaxLength
of 12 butscale
of 2 means you can have a number with 12 total digits, two of which are to the right of the decimal. This seems consistent with both python’s decimal module and how decimal types are implemented in most SQL systems. To be closer to SQL we could useprecision
instead ofmaxLength
butmaxLength
already exists and the two seem redundant.Another solution I’ve seen suggested is
"multipleOf": 0.01
. But I can’t say I love that 😃