News for hackers. Stuff that matters.
Re:LibBF – a small library to handle arbitrary precision flo... by cryptonector on Tuesday March 06, 2018 @05:31PM (#16532698)
This is perfect for jq[0].

[0] https://github.com/stedolan/jq

Re:LibBF – a small library to handle arbitrary precision flo... by jwilk on Tuesday March 06, 2018 @05:57PM (#16532842)
Why does jq need arbitrary precision floating-point numbers?
Re:LibBF – a small library to handle arbitrary precision flo... by geofft on Tuesday March 06, 2018 @06:28PM (#16533084)
Because JSON's spec defines a "number" as an arbitrary-precision floating point number, no limit on how many digits can be before or after the decimal or on what positive or negative integers you can put after the "e". Despite the name "JavaScript Object Notation," it does not inherit JavaScript's traditional interpretation that a "number" is an IEEE 754 double.

(JSON also does not permit infinities or NaN, which JavaScript does permit.)

http://json.org/

Re:LibBF – a small library to handle arbitrary precision flo... by re on Tuesday March 06, 2018 @09:09PM (#16533816)
Wouldn't jq be better served by a library supporting arbitrary precision decimal values? LibBF is for base-2 floating point.
Re:LibBF – a small library to handle arbitrary precision flo... by whyever on Wednesday March 07, 2018 @11:16AM (#16537358)
Probably yes, because you always want to convert to and from base 10 strings. mpdecimal [1] (which was developed for Python) might be a better choice, because it uses base 10 internally.

[1] http://www.bytereef.org/mpdecimal/

Re:LibBF – a small library to handle arbitrary precision flo... by dnautics on Tuesday March 06, 2018 @06:26PM (#16533068)
not that it's needed, but JSONschema has this kind of crazy part where it lets you do multipleOf for floating point numbers. Of course 2.7 is not a multiple of 0.3 in IEEE-64-bit FP.
Re:LibBF – a small library to handle arbitrary precision flo... by cryptonector on Tuesday March 06, 2018 @07:36PM (#16533448)
The most FAQ / most filed issue for jq may well be that IEEE754 sucks. Users are frequently surprised by IEEE754 issues.
Re:LibBF – a small library to handle arbitrary precision flo... by guipsp on Tuesday March 06, 2018 @05:51PM (#16532806)
...How is it perfect for jq?
Re:LibBF – a small library to handle arbitrary precision flo... by cryptonector on Tuesday March 06, 2018 @07:34PM (#16533445)
It has a suitable license (MIT), is rather complete, and has semantics that will not surprise jq users.