http://qs1969.pair.com?node_id=1222765


in reply to $var == 1 fails when $var = 1

Strange, I seem to remember someone (Laurent?) already replying in this thread with this classic link

What Every Programmer Should Know About Floating-Point Arithmetic

Well once again.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re: $var == 1 fails when $var = 1 (lost post)

Replies are listed 'Best First'.
Re^2: $var == 1 fails when $var = 1 (lost post)
by syphilis (Archbishop) on Sep 21, 2018 at 14:55 UTC
    Well once again

    Why ?

    Does that link actually answer either of the 2 issues raised by the OP ?
    Those 2 issues can be paraphrased as:

    1) Why does perl assert that $x is 1 when $x != 1 ?
    2) How is it that $x+$y+$z != $x+$z+$y ?

    Cheers,
    Rob
      primarily b/c I was worried about the lost post.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Re^2: $var == 1 fails when $var = 1
by Your Mother (Archbishop) on Sep 21, 2018 at 01:59 UTC

    o_0 I saw and upvoted that reply from Laurent_R too…

        Nopers. :|