Closed Gbury closed 1 year ago
A nice error would be better. Farith doesn't accept when the exponent is too small compared to the size of the mantissa, it is derived from an hypothesis of the IEEE definition of Flocq. I don't remember why it is important.
So there is no quick fix.
A nice error would be better. Farith doesn't accept when the exponent is too small compared to the size of the mantissa
Is there a way to have the exact condition that Farith
requires of the exponent/mantissa sizes ?
GenericFloat.check_param
Thanks, i'll use that for now.
@bobot : note however that the GenericFloat
module is not exposed by Farith
, and the only way I have managed to use it is to use the module alias generated by dune
Farith__GenericFloat
, which is not really meant to be used directly. Maybe the module (or at least some of its functions) could be exposed officially in the Farith
top-level module.
Separately, it would be nice if Farith
could be made to throw a specific exception in such cases, instead of raising an internal assertion failure (which is not reasonably catchable).
This was fixed as part of #151 : Dolmen now raises a proper error. We'll see later if we want/need to handle such exotic fp numbers.
When verifying models, there appears to be some operations on floating point values that raise unexpected exceptions. Consider the following example:
Trying to evaluate the formula e.g. using an empty model such as
sat ()
, should yield an error because thefp.min
function is not defined on+0/-0
, however, it appears that before that can happen, theFarith
library raises an assertion failure when trying to make the value for(_ +zero 2 4)
:I don't know much about floating point numbers, so I can't assess whether
(_ +zero 2 4)
has a well-defined semantics, however:Taking these two above points into account, I think that we should be able to correctly evaluate such expressions in
dolmen
. Therefore, this looks like it would need a fix inFarith
, cc @bobot . Until the fix is released, it could be interesting to know whether there are other similar cases whereFarith
crashes unexpectedly / what are the conditions on lenght of exponent/signifcand forFarith
to work, so that a more friendly error message can be displayed.