Jarkko Hietaniemi writes:
>> I don't think we do: for a long time we have taught people that "37xa"
>> numifies to 37, and I think it is unreasonable and unhelpful now to
>> change "0xa" to numify to something other than 0. I think your example
>> should numify to 0 + 10 + 0 = 10.
>
>Well, in that case we must go in the other direction and stop some
>Atof()s from numifying "0xa" to 10.
I agree with Hugo, but the portability problem remains.
Might something that does something similar to:
sub Atof {
my $_ = shift;
s/^\s*(\d+(?:\.\d+)).*$/$1/;
# $_ is now _only_ digits.
return strtod($_);
}
be a happy solution?
-R
Thread Previous
|
Thread Next