softfloat: define floatx80_round()

Add a function to round a floatx80 to the defined precision
(floatx80_rounding_precision)

Backports commit 0f72129281765ed64d26353284059f2bdcde7a23 from qemu
This commit is contained in:
Laurent Vivier 2018-03-03 20:57:25 -05:00 committed by Lioncash
parent 20b610390d
commit 4e8e8572c3
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 17 additions and 0 deletions

View file

@ -5046,6 +5046,22 @@ float128 floatx80_to_float128(floatx80 a, float_status *status)
}
/*----------------------------------------------------------------------------
| Rounds the extended double-precision floating-point value `a'
| to the precision provided by floatx80_rounding_precision and returns the
| result as an extended double-precision floating-point value.
| The operation is performed according to the IEC/IEEE Standard for Binary
| Floating-Point Arithmetic.
*----------------------------------------------------------------------------*/
floatx80 floatx80_round(floatx80 a, float_status *status)
{
return roundAndPackFloatx80(status->floatx80_rounding_precision,
extractFloatx80Sign(a),
extractFloatx80Exp(a),
extractFloatx80Frac(a), 0, status);
}
/*----------------------------------------------------------------------------
| Rounds the extended double-precision floating-point value `a' to an integer,
| and returns the result as an extended quadruple-precision floating-point

View file

@ -608,6 +608,7 @@ float128 floatx80_to_float128(floatx80, float_status *status);
/*----------------------------------------------------------------------------
| Software IEC/IEEE extended double-precision operations.
*----------------------------------------------------------------------------*/
floatx80 floatx80_round(floatx80 a, float_status *status);
floatx80 floatx80_round_to_int(floatx80, float_status *status);
floatx80 floatx80_add(floatx80, floatx80, float_status *status);
floatx80 floatx80_sub(floatx80, floatx80, float_status *status);