[Ada] Better accuracy in float-to-fixed conversions
This patch improves the accuracy of conversions from a floating point to
a fixed point type when the fixed point type has a specified Snall that is
not a power of two. Previously the conversion of Fixed_Point_Type'First to
some floating point number and back to Fixed_Point_Type raised Constraint
error. This result is within the accuracy imposed by tne Numerics annex of
the RM but is certainly undesirable. This patch transforms the conversion
to avoid extra manipulations of the 'Small of the type, so that the
identity:
Fixed_T (Float_T (Fixed_Val)) = Fixed_Val
holds over the range of Fixed_T.
2018-05-28 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch4.adb (Real_Range_Check): Specialize float-to-fixed conversions
when bounds of fixed type are static, to remove some spuerfluous
implicit conversions and provide an accurate result when converting
back and forth between the fixed point type and a floating point type.
gcc/testsuite/
* gnat.dg/fixedpnt5.adb: New testcase.
From-SVN: r260832