This provides correct rounding in the IEEE 754 sense for the Value attribute
of floating-point types in more cases, by bumping the number of significant
bits used in the initial integer mantissa obtained from parsing.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * libgnat/s-valuer.ads (System.Value_R): Add Parts formal parameter
        as well as Data_Index, Scale_Array and Value_Array types.
        (Scan_Raw_Real): Change type of Scale and return type.
        (Value_Raw_Real): Likewise.
        * libgnat/s-valuer.adb (Round_Extra): Reorder parameters and adjust
        recursive call.
        (Scan_Decimal_Digits): Reorder parameters, add N parameter and deal
        with multi-part scale and value.
        (Scan_Integral_Digits): Likewise.
        (Scan_Raw_Real): Change type of Scale and return type and deal with
        multi-part scale and value.
        (Value_Raw_Real): Change type of Scale and return type and tidy up.
        * libgnat/s-valued.adb (Impl): Pass 1 as Parts actual parameter.
        (Scan_Decimal): Adjust to type changes.
        (Value_Decimal): Likewise.
        * libgnat/s-valuef.adb (Impl): Pass 1 as Parts actual parameter.
        (Scan_Fixed): Adjust to type changes.
        (Value_Fixed): Likewise.
        * libgnat/s-valrea.adb (Need_Extra): Delete.
        (Precision_Limit): Always use the precision of the mantissa.
        (Impl): Pass 2 as Parts actual parameter.
        (Exact_Log2): New expression function.
        (Integer_to_Real): Change type of Scale and Val and deal with a
        2-part integer mantissa.
        (Scan_Real): Adjust to type changes.
        (Value_Real): Likewise.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to