diff options
author | John Hauser <jhauser@eecs.berkeley.edu> | 2017-02-10 12:35:21 -0800 |
---|---|---|
committer | John Hauser <jhauser@eecs.berkeley.edu> | 2017-02-10 12:35:21 -0800 |
commit | 9d731d45e86ae28cf13b0094979577061e0e811c (patch) | |
tree | 0fb71733a01f5b8975ae1bf77b09a1c9edaac407 /source/f16_roundToInt.c | |
parent | cb5087cd7403acf31ac24ac4be8e019a51904895 (diff) | |
download | berkeley-softfloat-3-9d731d45e86ae28cf13b0094979577061e0e811c.zip berkeley-softfloat-3-9d731d45e86ae28cf13b0094979577061e0e811c.tar.gz berkeley-softfloat-3-9d731d45e86ae28cf13b0094979577061e0e811c.tar.bz2 |
Release 3c. See "doc/SoftFloat-history.html".
Diffstat (limited to 'source/f16_roundToInt.c')
-rw-r--r-- | source/f16_roundToInt.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/f16_roundToInt.c b/source/f16_roundToInt.c index 9fa9693..57289f8 100644 --- a/source/f16_roundToInt.c +++ b/source/f16_roundToInt.c @@ -2,9 +2,9 @@ /*============================================================================ This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic -Package, Release 3b, by John R. Hauser. +Package, Release 3c, by John R. Hauser. -Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -94,10 +94,11 @@ float16_t f16_roundToInt( float16_t a, uint_fast8_t roundingMode, bool exact ) } else if ( roundingMode == softfloat_round_near_even ) { uiZ += lastBitMask>>1; if ( ! (uiZ & roundBitsMask) ) uiZ &= ~lastBitMask; - } else if ( roundingMode != softfloat_round_minMag ) { - if ( signF16UI( uiZ ) ^ (roundingMode == softfloat_round_max) ) { - uiZ += roundBitsMask; - } + } else if ( + roundingMode + == (signF16UI( uiZ ) ? softfloat_round_min : softfloat_round_max) + ) { + uiZ += roundBitsMask; } uiZ &= ~roundBitsMask; if ( exact && (uiZ != uiA) ) { |