diff options
Diffstat (limited to 'source/f32_roundToInt.c')
-rw-r--r-- | source/f32_roundToInt.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/f32_roundToInt.c b/source/f32_roundToInt.c index 00577f8..82660ad 100644 --- a/source/f32_roundToInt.c +++ b/source/f32_roundToInt.c @@ -2,10 +2,10 @@ /*============================================================================ 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 The Regents of the University of California. -All rights reserved. +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -94,10 +94,11 @@ float32_t f32_roundToInt( float32_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 ( signF32UI( uiZ ) ^ (roundingMode == softfloat_round_max) ) { - uiZ += roundBitsMask; - } + } else if ( + roundingMode + == (signF32UI( uiZ ) ? softfloat_round_min : softfloat_round_max) + ) { + uiZ += roundBitsMask; } uiZ &= ~roundBitsMask; if ( exact && (uiZ != uiA) ) { |