in reply to Determining the minimum representable increment/decrement possible?

As is often the case, your difficult problem is really two problems. '1.9041105342991877e+258' is a floating point value to a mathematician, but to perl it is a string. When you convert that string to your computer's floating point and back to a string, the resulting string may not be exactly the same. This has nothing to do with addition. The addition introduces another problem. When the value that you add is sufficiently small, You do not change the floating point representation. If it is just large enough to change the representation, you may not be able to tell after converting back to a string. Sorry, the interaction of these two problems is much to complicated for me.

A pure perl issue can complicate things some more. A scalar has a string and a numeric value. Perl does an excellent job of choosing the right one, but in special cases, it can surprise us. I doubt that this is a concern for any of your examples.

Bill
  • Comment on Re: Determining the minimum representable increment/decrement possible?

Replies are listed 'Best First'.
Re^2: Determining the minimum representable increment/decrement possible?
by BrowserUk (Patriarch) on Jun 15, 2016 at 19:06 UTC
    '1.9041105342991877e+258' is a floating point value to a mathematician, but to perl it is a string.

    Sorry, but that is a red-herring:

    printf "% 25.17g\n", 1.9041105342991877e+258;; 1.9041105342991886e+258

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.