Yes, that's exactly what it does.
What I'm trying to work out is why it stores 0 as '0E1' if it stringifies to '0'? DBI functions return zero as '0E0' so that it becomes 'true' in a boolean context, but if you evaluate a Math::BigFloat zero in a boolean context it becomes 'false'. So why not just store it internally as '0'? What is gained by storing as '0E1'?
My second question is why use '0E1' instead of the more usual '0E0'? They both become 0 in a numerical context and stringify to '0'.
| [reply] |
Well, Math::BigFloat is about floating point numbers. Not about integers. So, to me it makes a lot of sense to store it as a significant/exponent pair, and not a plain integer. Note that the internal representation is not "0E1". The internal representation is:
{
_e => 1,
_es => '+',
_m => [0],
sign => '+',
}
which corresponds to 0E1. | [reply] [d/l] [select] |
Did you try looking up Knuth's reasoning?
| [reply] |
Yes, and I can't find it.
My best guess is that Knuth discussed 00 being less securely defined than 01, and possibly the author of Math::BigFloat was making a joke on this, but 0E0 is not related to 00 and is very much defined.
| [reply] |