LWN.net Logo

They should be paying attention to the lumberjack project

They should be paying attention to the lumberjack project

Posted Apr 14, 2012 1:16 UTC (Sat) by dlang (✭ supporter ✭, #313)
In reply to: They should be paying attention to the lumberjack project by aliguori
Parent article: Toward more reliable logging

I may be missing something, but as I understand it, JSON does let you represent Integers, it doesn't force all numbers to be floating point

I raised the issue of very large integers (>32 bits) and the feeling is that they are rare enough that we can live with them being treated as strings.


(Log in to post comments)

They should be paying attention to the lumberjack project

Posted Apr 14, 2012 4:20 UTC (Sat) by nybble41 (subscriber, #55106) [Link]

Even if it did force all numbers to be floating-point, the range of integers which can be represented precisely in double-precision (eight-byte) IEEE floating point format is a superset of both signed and unsigned 32-bit fixed-point notation.

Floating-point has a certain reputation, but much of it is undeserved, at least for plain integer math. Lua, for example, treats all numbers as double-precision floating point by default on platforms with an FPU; there is no separate integer type. You only run into problems when you exceed 52 significant bits. (Note that any fraction with a factor larger than two in the denominator requires infinite significant bits, which is obviously much more than 52. This is where most of the reputation originates. However, it doesn't affect integers.)

They should be paying attention to the lumberjack project

Posted Apr 14, 2012 10:58 UTC (Sat) by liljencrantz (guest, #28458) [Link]

JavaScript does the same.

They should be paying attention to the lumberjack project

Posted May 30, 2012 21:38 UTC (Wed) by scientes (guest, #83068) [Link]

>(Note that any fraction with a factor larger than two in the denominator requires infinite significant bits, which is obviously much more than 52. This is where most of the reputation originates. However, it doesn't affect integers.)

not really. It's rather, any factor with a denominator that is not in the part of the set 2^n, (or with decimal floating point, 2^n * 5^m)

They should be paying attention to the lumberjack project

Posted May 31, 2012 0:19 UTC (Thu) by nybble41 (subscriber, #55106) [Link]

>> (Note that any fraction with a factor larger than two in the denominator requires infinite significant bits, which is obviously much more than 52. This is where most of the reputation originates. However, it doesn't affect integers.)

> not really. It's rather, any factor with a denominator that is not in the part of the set 2^n, (or with decimal floating point, 2^n * 5^m)

I was referring to the prime factors; any number of the form 2^n * 5^m with naturals n and m (!= 0) has prime factors 2 and 5. A number with a prime factor of 3 or 7, for example, would not terminate in either binary or decimal. However, your description is equivalent.

They should be paying attention to the lumberjack project

Posted Apr 27, 2012 15:42 UTC (Fri) by mirabilos (subscriber, #84359) [Link]

JSON definitely does not put any upper or lower boundaries on integers, so the limits of the language or parser/encoder that operate on it apply.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds