I am not claiming this is entirely the correct way to do this in this
package, just that it works fairly easily to expand the scope of the
Conversions goodie, as well.
Gonna need feedback from @moollaza and @mintsoft.
On the upside, I found a bug in the styler code by writing a test here!
Considering how all of this works, I'm not sure roles are quite the
right fit. It seems like we might just want a shared "Utility" package
or namespace to let us have access to some common library functions.
DDG::GoodieRole::NumberStyle is a particularly horrible name because
it's not even a role!
Also, the comments suck.
But such is the nature of a proof-of-concept.
This would be better with some proper parsing, but this resolves some
issues with the current HTML output, making it raise things to
arbitrarily high superscripting levels based on what it seems to look
like.
I think this makes it somewhat easier to follow the intent here. We're
just trying to convert these two known strings into different output
formats, so wrapping that up seems like a good idea.
The old version clearly worked, but it was clunky and somewhat
inexplciable. While reading up on something else, I discovered `perldoc
quotemeta` which resolves this in a much more predictable and correct
way.
There should never be a thousands separator in that place, so don't
allow one. This was a bit masked by taking all of the numbers in
combination which gave them more context.
Testing a number individually exposed the error.
This includes multiplication and division in things which should not be
rounded to our determined precision. While this doesn't break any
current tests, it might lead to some surprising floating-point issues.
On the other hand, the other way led to some surprising results where
418.10 / 2 != 418.1 / 2
Hopefully there exists a better long-term solution which we'll find soon
enough.
Addresses issue #509.