Lack of robustness or optimisation of the mpfi_abs function ?
Imported issue: Initially reported by Fabrice Larribe in https://gforge.inria.fr/tracker/?group_id=157&aid=18277
I tried the ""mpfi_abs"" function on a malformed interval : [1e0, -1e0]
The result is non coherent : [ 0.0000000000, -1.0000000000]
This result can be normal if the incoherent input is non admissible for this function.
In this case, an optimization is possible.
The ""mpfi_abs"" function call the ""MPFI_IS_NONNEG"" macro. this macro is defined as follow:
#define MPFI_IS_NONNEG(x) ((mpfr_sgn((&(x->left)))>=0) && (mpfr_sgn((&(x->right)))>=0))
If the ""malformed intervals"" are not supported, so a macro as follow can be used :
#define MPFI_IS_NONNEG(x) ((mpfr_sgn((&(x->left)))>=0)
Such a macro is less ""time consuming"".
I join a simple example that demonstrate the ""mpfi_abs"" behaviors with the ""[1e0, -1e0]"" input.