Re: Phix value() function
- Posted by petelomax in January
- 578 views
it doesn't accept &b… and &h… for binary and hex numbers
I'm confused: are you saying value() does accept &b and &h?
to_number() allows/ignores underscore characters in a number (why?)
Just because 1_000_000_000 is easier to read than 100000000, and in some senses easier to type (and partly because it don't allow/support 1,000,000,000).
Did you spot the deliberate typo I did there?
when I try ? to_number("65'A'") Phix crashes
Quite right, that was a silly bug, I'd even left myself a "this don't look right" comment just before that line, presumably while too busy to test/fix it, which I now have:
-- allow eg 65'A' to be the same as 65: --DEV could probably do with some more bounds checking here (spotted in passing) -- if scan_ch='\'' and s[sidx]=N and s[sidx+2]='\'' then if scan_ch='\'' and scan_ch2=N and sidx<length(s) and s[sidx+1]='\'' then
But, if you promise I can keep using value(), I'm happy enough!
Of course, I have no problem at all with that, especially "as-is".
I added a little "Don't panic" remark against that overly dramatic threat.
Pete