aboutsummaryrefslogtreecommitdiff
path: root/fpu
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2017-06-28 22:42:38 +0200
committerLaurent Vivier <laurent@vivier.eu>2017-06-29 20:27:39 +0200
commit0f72129281765ed64d26353284059f2bdcde7a23 (patch)
tree4092bf1b51512a9d25067587b97630314f034fd0 /fpu
parenta51b6bc38bb9b73a40e9486b52be12c810c6f2d9 (diff)
softfloat: define floatx80_round()
Add a function to round a floatx80 to the defined precision (floatx80_rounding_precision) Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Message-Id: <20170628204241.32106-5-laurent@vivier.eu>
Diffstat (limited to 'fpu')
-rw-r--r--fpu/softfloat.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 7af14e29aa..433c5dad2d 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -5086,6 +5086,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
| value. The operation is performed according to the IEC/IEEE Standard for