Quadmath.jl icon indicating copy to clipboard operation
Quadmath.jl copied to clipboard

Bug: "prec not defined in Main"

Open JeffreySarnoff opened this issue 7 months ago • 2 comments

This has been happening when I mix use of Float128 and BigFloat. I do not have an example that recreates the error.
There is a path in function Float128(x::BigFloat) that allows for the use of "prec" when it has not been set.

JeffreySarnoff avatar Jul 18 '25 07:07 JeffreySarnoff

It looks like this happens for nonzero arguments closer to zero than the smallest denormal Float128, so I think we may just need to ~add a~ fix the branch which returns the properly signed Float128(0) for these.

RalphAS avatar Jul 18 '25 14:07 RalphAS

These branches are the problematic ones it seems: https://github.com/JuliaMath/Quadmath.jl/blob/f6ea87e58fa4bdf1dfbf4179f91e298c337278ee/src/Quadmath.jl#L542-L546

AFAICT from a quick glance, it seems in both cases it would be possible to directly return copysign(z, x) (or alternatively skip subsequent computations of z).

devmotion avatar Jul 21 '25 09:07 devmotion