New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NaNcytyping appears to have regressed and broken again in 5.8.8 #8807
Comments
From @obraCreated by jesse@bestpractical.comLast night, I was chatting with a pythonista friend of mine who cracked a joke about how poorly 5.6 worked, using as his example "nancytyping." (0 + "Nancy" numifies to "NaN"). He admitted that this had been fixed for 5.8.x or so. As I was playing around, I discovered that 1) Yes, it had been fixed, at least by 5.8.4..and appears to have stayed fixed though 5.8.7 2) It appears to have broken again for 5.8.8 and a recent blead. 3) There are no tests for it. The following testfile should probably get added to core: #!./perl BEGIN { use strict; use Test::More tests => 2; # 5.6 and 5.8.8 and newer appear to treat "Nancy" as "NaN", leading to is (0+"Nancy", 0); Perl Info
|
From @ysthJesse Vincent wrote:
To me, 0+"Nancy" being NaN is consistent with how numeric values are treated |
The RT System itself - Status changed from 'new' to 'open' |
From @schwernYitzchak Scott-Thoennes wrote:
Interpreting "123beer" as 123 is already pretty desperate but at least At least they warn. |
From @ysth
The idea is that you be able to take a stringized number and get vaguely We could add another, more specific, warning when we notice that only |
From @nwc10On Wed, Feb 28, 2007 at 09:22:28PM -0800, Michael G Schwern wrote:
I thought that the have /\A-?inf(?:inity)?\z/i as the valid ways of spelling I *think* that all this broke between 5.6.x and 5.8.0, in that in 5.6.x I don't have a machine with 5.6.x where 'NaN' is NaN, but I tried this #include <stdio.h> int main(int argc, char **argv) { on FreeBSD, Linux and Solaris and the results are, well, not what I'd hoped $ ./atof 42 infinity nan nancy NaN infinite infinitesimal -inFerior $ ./atof 42 infinity nan nancy NaN infinite infinitesimal -inFerior $ ./atof 42 infinity nan nancy NaN infinite infinitesimal -inFerior (and not what I thought happened when I chatted to Jesse about this on IRC) Well, at least Solaris still is C, rather than C99: $ ./atof 0x3 0x3p2 $ ./atof 0x3 0x3p2 $ ./atof 0x3 0x3p2 It was that bit of C99 stupidity that prompted this whole issue, IIRC. You thought long long was bad - wait until you realise that they changed the Nicholas Clark |
From @demerphqOn 3/1/07, Nicholas Clark <nick@ccl4.org> wrote:
For the record here is what VC7 does: D:\dev\perl\ver>atof 42 infinity nan nancy NaN infinite infinitesimal -inFerior -- |
From @ysthNicholas Clark wrote:
But I hear Jesse saying that what you and I call broke, he called a fix. So what's your take on this, Nicholas?
Not what you hoped for how? You might also try strtod and see how
Yeah, that really, really sucked. |
From @ysthdemerphq wrote:
msvcrt (all versions, AFAIK) just plain doesn't do this. |
From @obraOn Thu, Mar 01, 2007 at 11:32:01AM -0800, Yitzchak Scott-Thoennes wrote:
The backstory I'd gotten from folks was "this was broken in 5.6, fixed I have no investment in one outcome or the other. (If you're trying to So, I think I'd like to see my tests end up in core to make sure that -jesse |
From @schwernYitzchak Scott-Thoennes wrote:
Yep, and I'm willing to bet that most folks would not guess that "Nancy" ==
Ok, let's define it a little better then. lc $thing eq "nan" -> nan Everything else: 0 and a warning. I'll bet this is all just a consequence of logic like "find the longest OTOH the heuristic of "it will use the longest prefix which looks like a |
From @ysthMichael SG chwern wrote:
I was describing NV -> string and trying to say that string -> NV should
That heuristic certainly wins the "whatever is shortest to document" front, |
From @schwernYitzchak Scott-Thoennes wrote:
Yeah, wasn't that the whole point of the bug? I thought NV -> string was pretty well handled, if not exactly spelled out |
Migrated from rt.perl.org#41645 (status was 'open')
Searchable as RT41645$
The text was updated successfully, but these errors were encountered: