News for hackers. Stuff that matters.
Re:Every day I learn something new... and stupid. by haberman on Friday October 15, 2010 @09:12PM (#1797000)
Same is true in Lua (only one number type, which is double by default), though you have the option to compile it to use a different number type instead.

http://www.lua.org/pil/2.3.html

In particular, "long double" on x86 can represent 64 bit integers without loss as well as being floating-point (64 bit mantissa, 15 bit exponent, 1 bit sign). Downside is that it's quite large: 16 bytes.

Re:Every day I learn something new... and stupid. by silentbicycle on Friday October 15, 2010 @10:56PM (#1797202)
Also, Lua has a couple bignum libraries available (a GMP wrapper, etc.) - it's explicitly noted in the manual that using doubles for Lua numbers by default is just a pragmatic trade-off, and they can be adapted as necessary.
Re:Every day I learn something new... and stupid. by wnoise on Friday October 15, 2010 @10:21PM (#1797143)
That's 10 bytes. Is it padded to 16 for alignment?
Re:Every day I learn something new... and stupid. by haberman on Friday October 15, 2010 @10:34PM (#1797168)
Yep. sizeof(long double) == 16, at least for me on gcc and Linux. Keep in mind that different compilers implement "long double" differently. According to Wikipedia, MSVC++ just makes it a synonym for "double," but most other compilers on x86 make it this 80-bit "extended precision" floating point.
Re:Every day I learn something new... and stupid. by SAHChandler on Saturday October 16, 2010 @04:29AM (#1797607)
With MSVC on x86, you can pass /Qlong-double to the compiler for it to "properly size" the long double type :)