Wolfram seems to excel at so many things, but does anyone actually use it? https://www.wolframalpha.com
9999999999999999.0 – 9999999999999998.0
41–50 of 83 posts
Re: 9999999999999999.0 – 9999999999999998.0
#42Wolfram seems to excel at so many things, but does anyone actually use it? https://www.wolframalpha.com
Re: 9999999999999999.0 – 9999999999999998.0
#43> That Go uses arbitrary-precision for constant expressions seems dangerous to me. I'm somewhat baffled by this statement. If a Go program compared a constant expression float against a runtime computed float, it could have unexpected results, but comparing floats in general is dangerous. I don't see how this language quirk increases that danger in a meaningful way.
It's another thing if a language sometimes outputs two and sometimes outputs one depending on the syntax of the request. This is reasonable where that syntax change is not an explicit cast to double precision or single precision, but dangerous if it uses a behind-the-scenes default of arbitrary precision in compiled literals and a default of FP32 in implicitly typed literal assignments.
Re: 9999999999999999.0 – 9999999999999998.0
#44Wolfram seems to excel at so many things, but does anyone actually use it? https://www.wolframalpha.com
Re: 9999999999999999.0 – 9999999999999998.0
#45IEEE754 is always fun. 9007199254740993 is the first integer that cannot be represented as a double precision float. So in python: >>> 9007199254740993.0 9007199254740992.0 What's really surprising is that this number is only ~16 million in single precision floats.
Half of all floats are in [-1, 1].
Re: 9999999999999999.0 – 9999999999999998.0
#46Wolfram seems to excel at so many things, but does anyone actually use it? https://www.wolframalpha.com
Re: 9999999999999999.0 – 9999999999999998.0
#47>>> Decimal("9999999999999999.0") - Decimal("9999999999999998.0")
Decimal('1.0')
Re: 9999999999999999.0 – 9999999999999998.0
#48> That Go uses arbitrary-precision for constant expressions seems dangerous to me. I'm somewhat baffled by this statement. If a Go program compared a constant expression float against a runtime computed float, it could have unexpected results, but comparing floats in general is dangerous. I don't see how this language quirk increases that danger in a meaningful way.
var d = -0.0
is different than var d = 0.0
d = -d
This IMO crosses the line into "outright bug" territory.Re: 9999999999999999.0 – 9999999999999998.0
#49Re: 9999999999999999.0 – 9999999999999998.0
#50The page never explicitly states what the right answer is, but based on the output of their suggested "correct" perl, we can infer that they expect 1. This is just me being idiosyncratic I guess, but if I see a number with a decimal place, I default to interpreting it as an fp64 unless otherwise specified - which yields a "correct" answer of 2.0 (which is not an answer I can get to in my head, admittedly) If the ques…