Live data from Hacker News

9999999999999999.0 – 9999999999999998.0

geocar.sdf1.org

61–70 of 83 posts

Re: 9999999999999999.0 – 9999999999999998.0

#61
I was curious about `soup`, clicking on it, the author states:

>soup is a programming language I've been working on for a few years that is designed to make it easier for the programmer to write fast, robust programs with no bugs. >Availability >I'm sorry to say soup is not yet available for general use.

Now I am curious what this is.

Re: 9999999999999999.0 – 9999999999999998.0

#62
post #45

IEEE754 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.

> What's really surprising is that this number is only ~16 million in single precision floats Half of all floats are in [-1, 1].

Any real number type must have this property is you expect 1/x to work correctly.

Re: 9999999999999999.0 – 9999999999999998.0

#63
post #10

bc -l is my standard command-line tool for arbitrary precision calculations (-l not needed here but handy for functions like sqrt(), e(), and log l() ): $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 9999999999999999.0 - 9999999999999998.0 1.0

bc is my calculator for pretty much everything for decades now. lol

who does not use bc? people who aren't old unix people ;-) I use bc

Re: 9999999999999999.0 – 9999999999999998.0

#64
post #57

Earlier quoted context omitted.

"math" is just yet another (implicit and at times poorly defined) standard. The answers are all equally "correct" given a particular set of operating rules, the interesting part is what rules they picked. Edit: See also, https://en.wikipedia.org/wiki/Definitions_of_mathematics - "Mathematics has no generally accepted definition"

I agree that what we call "math" is just a set of rules that could be defined differently, but a standard like IEEE-754 is downstream of math, and is explicitly defined as a method to perform arithmetic (which is part of math). So they aren't on the same level, IEEE-754 is not an alternative standard to math. The answers can all be considered correct by a certain definition, but they are not equally correct in our sh…

Math is not a singular set of rules, it depends on who you ask, and what the context is. We have a pretty decent shared understanding, but it's not perfectly uniform.

59 + 1 can very reasonably be 1:00, for example.

I'm not saying 2.0 is the correct answer, I'm just saying it's not any less correct than 1 is.

Re: 9999999999999999.0 – 9999999999999998.0

#66
post #10

bc -l is my standard command-line tool for arbitrary precision calculations (-l not needed here but handy for functions like sqrt(), e(), and log l() ): $ bc -l bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 9999999999999999.0 - 9999999999999998.0 1.0

I got tired of typing bc -l years ago, I have a function so I can do it on the command line: calc 2^27 + 3^15. I wish somehow the shell would let me add parens here, instead of having to escape them with a quote.

function calc2 { if [ $# -eq 0 ]; then echo 'pass commands for math evaluation, like calc l(2^32/17) + 3'; fi; echo $* | bc -l; }

Re: 9999999999999999.0 – 9999999999999998.0

#67
post #63

Earlier quoted context omitted.

bc is my calculator for pretty much everything for decades now. lol

who does not use bc? people who aren't old unix people ;-) I use bc

I consider myself an old unix person, but I use dc. Possibly to make it more confusing to anyone who looks at what I'm doing.

It also gives the math result here of course.

  % dc
  9999999999999999.0 9999999999999998.0 - p
  1.0
  %

Re: 9999999999999999.0 – 9999999999999998.0

#69
post #67
post #63

Earlier quoted context omitted.

who does not use bc? people who aren't old unix people ;-) I use bc

I consider myself an old unix person, but I use dc. Possibly to make it more confusing to anyone who looks at what I'm doing. It also gives the math result here of course. % dc 9999999999999999.0 9999999999999998.0 - p 1.0 %

rpn for for the win I guess ;-). I actually didn't get to try my first linux stuff until grad school in the 80s. I wish I had saved off all my init files from then to see what they look like now.

Re: 9999999999999999.0 – 9999999999999998.0

#70

Floating point 101. And it almost never matters.

For me, I encounter a floating point bug/issue every 4 years of so. So "almost never" sounds about right to me.

I encounter bugs around this semi-rarely, but most of my career has been building tools around data analytics. While it's rare that I encounter bugs tied to floating point it's frequent that I need to be aware of floating point math and if a float will be acceptable here. The rareness of the bug has more to do with it being a rookie mistake that won't make it past code review than "it doesn't matter" as the comment implies.
Post reply on HN