Live data from Hacker News

9999999999999999.0 – 9999999999999998.0

geocar.sdf1.org

271–274 of 274 posts

Re: 9999999999999999.0 – 9999999999999998.0

#271

Earlier quoted context omitted.

Would you really call 'any rational with divisible factors other than 2 and 5' to be 'exotic'? Maybe we really should move back to base-60 like the Babylonians used, then you could at least divide by 3.

Because humans standardized on base-10, and computers are ultimately for humans to use?

Maybe we should also add data types to every language that can convert exactly between inches, feet, miles and every other non-base-10 unit?

The argument "we want to look at base-10 in the end so it should be the internal representation" is really weak and ignores basically every other practical aspect.

Re: 9999999999999999.0 – 9999999999999998.0

#272

Are there any mainstream languages that consider a decimal number to be a primitive type? I feel like floating point numbers are far less meaningful in every day programs. Even 2d graphics would be easier with decimal numbers. Unless you're using numbers that scale from very small to very large, like 3d games or scientific calculations, you don't actually want to use floating point.

> Are there any mainstream languages that consider a decimal number to be a primitive type Mathematica. But it's not particularely fast. > Unless you're using numbers that scale from very small to very large, like 3d games or scientific calculations, you don't actually want to use floating point. Unfortunately, we can sometimes only use floats in 3D graphics and floats aren't even good for semi-large to large 3D scen…

Not to mention z-fighting for distant objects.

Re: 9999999999999999.0 – 9999999999999998.0

#273

The linked post is a bit poorly expressed, but I think there is a good point there: fixed-size binary floating-point numbers are a compromise, and they are a poor compromise for some applications, and difficult to use reliably without knowing about numerical analysis. (For example, suppose you have an array of floating-point numbers and you want to add them up, getting the closest representable approximation to the t…

Do note that UB on integer overflow is (at least nowadays) more of a compiler wish for optimization reasons than it is technically necessary (your CPU will indeed just wrap around if you don't live in the 80s anymore, but a C++ compiler might have assumed that won't happen for a signed loop index).

Re: 9999999999999999.0 – 9999999999999998.0

#274
post #211

Earlier quoted context omitted.

To me the only downside of IEEE 754 is that most languages including C and C++ do not provide a sensible canonical comparison methods. This leads to surprised beginners and then a ton of home made solutions which are often not appropriate.

Would you really want a default comparison where a == b does not imply a - b == 0?

I think it depends, in languages which have implicit type coercion I think that would hurt. In languages like swift, where you need to explicitly cast even an Int to Double it would be less of a footgun. I'd rather floats have some overloaded operator maybe ~=, for approximate comparison.
Post reply on HN