in reply to Re^4: Why does sv_2nv on non-number look like an NV
in thread Why does sv_2nv on non-number look like an NV
why would sv_2nv convert "aa" to a [...] double
Because you asked it to.
how may I avoid this but still have it work for real numbers.
If you need an NV, "aa" would be an error. There are ways of checking that (looks_like_number), but you say you don't want that.
If you need an SV that contains a number if possible, you already have that. You don't need to do anything. Useless numifying is useless.
If it's not useless, it's because you have code that treats PV 1.2 different than NV 1.2, and that's a bug. Perl has an example of that (bitwise ops), and it has caused many headaches.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Why does sv_2nv on non-number look like an NV
by mje (Curate) on Nov 26, 2009 at 16:21 UTC | |
by ikegami (Patriarch) on Nov 26, 2009 at 16:24 UTC | |
by mje (Curate) on Nov 26, 2009 at 16:42 UTC | |
by mje (Curate) on Nov 26, 2009 at 17:22 UTC |