syphilis has asked for the wisdom of the Perl Monks concerning the following question:
The weirdness is that the output changes after the first iteration of the for() loop even though the expression being evaluated doesn't.>perl -le "for(0x1p+60, 0x1p+60, 0x1p+60) { print $_ + 1 }" 1.15292150460685e+18 1152921504606846977 1152921504606846977
we see that the first iteration treats "$_ + 1" as an NV, and the subsequent iterations treat "$_ + 1" as an IV ... but that doesn't really answer the question, it just re-phrases it.>perl -MDevel::Peek -le "for(0x1p+60, 0x1p+60, 0x1p+60) { Dump $_ + 1 +}"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange behaviour when printing certain numeric values
by NERDVANA (Priest) on Jan 17, 2024 at 18:02 UTC | |
by hv (Prior) on Jan 17, 2024 at 19:55 UTC | |
by syphilis (Archbishop) on Jan 18, 2024 at 02:54 UTC | |
by choroba (Cardinal) on Jan 17, 2024 at 19:11 UTC | |
|
Re: Strange behaviour when printing certain numeric values
by ikegami (Patriarch) on Jan 19, 2024 at 14:48 UTC | |
|
Re: Strange behaviour when printing certain numeric values
by harangzsolt33 (Curate) on Jan 17, 2024 at 17:02 UTC | |
by choroba (Cardinal) on Jan 17, 2024 at 19:08 UTC |