Re: Phix value() function
- Posted by RobertS Jan 26, 2024
- 772 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?
Omg — omg — omg, I am so incredibly stupid, I can't believe it! Sorry! In fact, I wrote my own routine to deal with &b and &h, and totally forgot that it was silently operating in the depths of Hypatia's engine room — my only excuse being that this was in 2007, and I never thought about it again, always assuming it was value() itself that processed binary and hex input.
So, yes, sure, since I already have this routine, I could use it with to_number() just as well. I withdraw my objection against it!
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?
I'd write 1Esomething :)
But yes, I see your point — just, would it be possible to allow _ only where it might belong — that is, 7_000 would be ok, but 70_00 not?
But admittedly, this is a minor issue, and if I really feel it's worth the effort I could do it myself, but it's probably not.
I added a little "Don't panic" remark against that overly dramatic threat.
Thank you! :)
And again, forgive my stupidity not to remember my own code!
Robert