Open hvds opened 1 year ago
hi. sorry for the late reply. the code seems out of scope of the integral operations only Math-GMP.
I think that's fair in respect of bfdiv()
; I see log()
and log10()
as ways of getting information about a number when you can't do that with a simple conversion. We do support conversion to scalar or string, but when that gives you "inf" there is little more you can do with it.
An alternative might be a brief note in the docs that points to this ticket for some handy utility functions for dealing with very large numbers, which (with appropriate caveats) would let people find them without you needing to take responsibility for maintaining them.
One of my long-running projects has recently reached new heights, dealing with integers greater than 1.8e308. That's fine in the core code where I deal with them as integers, but for some peripheral cases I need to do some float handling, and that code suddenly came crashing down.
I've now worked around that by injecting three extra Math::GMP methods, as below. I'm not sure whether some or all of these are appropriate to include in Math::GMP itself; if you think they would be, I'll put some effort into coming up with implementations that are more robust and efficient, and some tests. (And maybe a better name for
bfdiv
).I've also implemented a hack to let me get a
sprintf("%g", $gmp)
that works for large values with string trickery, but I haven't come up with a way to do it more robustly. (I haven't yet tested it, but docs imply thatgmp_sprintf
would not support a"%Zg"
format.)Let me know what you think.
(edited to
s/self/sself/
inbfdiv
)