From: Toni Wilen Date: Fri, 4 May 2018 18:39:14 +0000 (+0300) Subject: Set infinity instead of clamping to max value. X-Git-Tag: 4000~77 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=f1afe7ed1747bca2a431d3b32d75c1a875dcf100;p=francis%2Fwinuae.git Set infinity instead of clamping to max value. --- diff --git a/fpp_native.cpp b/fpp_native.cpp index ea040041..c1ccde50 100644 --- a/fpp_native.cpp +++ b/fpp_native.cpp @@ -384,7 +384,11 @@ static void fp_to_exten(fpdata *fpd, uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3) floatx80 fx80; fx80.high = wrd1 >> 16; fx80.low = (((uae_u64)wrd2) << 32) | wrd3; + fs.float_exception_flags = 0; float64 f = floatx80_to_float64(fx80, &fs); + // overflow -> infinity + if (fs.float_exception_flags & float_flag_overflow) + f = 0x7ff0000000000000 | (f & 0x8000000000000000); fp_to_double(fpd, f >> 32, (uae_u32)f); #else double frac; @@ -1064,17 +1068,17 @@ static void fp_from_pack (fpdata *src, uae_u32 *wrd, int kfactor) fptype fp; fp_is_init(src); - if (fp_is_nan(src)) { - // copy bit by bit, handle signaling nan - fpp_from_exten(src, &wrd[0], &wrd[1], &wrd[2]); - return; - } - if (fp_is_infinity(src)) { - // extended exponent and all 0 packed fraction - fpp_from_exten(src, &wrd[0], &wrd[1], &wrd[2]); - wrd[1] = wrd[2] = 0; - return; - } + if (fp_is_nan(src)) { + // copy bit by bit, handle signaling nan + fpp_from_exten(src, &wrd[0], &wrd[1], &wrd[2]); + return; + } + if (fp_is_infinity(src)) { + // extended exponent and all 0 packed fraction + fpp_from_exten(src, &wrd[0], &wrd[1], &wrd[2]); + wrd[1] = wrd[2] = 0; + return; + } wrd[0] = wrd[1] = wrd[2] = 0;