xref: /linux/arch/arm/nwfpe/softfloat-specialize (revision 50a23e6eec6f20d55a3a920e47adb455bff6046e)
11da177e4SLinus Torvalds
21da177e4SLinus Torvalds/*
31da177e4SLinus Torvalds===============================================================================
41da177e4SLinus Torvalds
51da177e4SLinus TorvaldsThis C source fragment is part of the SoftFloat IEC/IEEE Floating-point
61da177e4SLinus TorvaldsArithmetic Package, Release 2.
71da177e4SLinus Torvalds
81da177e4SLinus TorvaldsWritten by John R. Hauser.  This work was made possible in part by the
91da177e4SLinus TorvaldsInternational Computer Science Institute, located at Suite 600, 1947 Center
101da177e4SLinus TorvaldsStreet, Berkeley, California 94704.  Funding was partially provided by the
111da177e4SLinus TorvaldsNational Science Foundation under grant MIP-9311980.  The original version
121da177e4SLinus Torvaldsof this code was written as part of a project to build a fixed-point vector
131da177e4SLinus Torvaldsprocessor in collaboration with the University of California at Berkeley,
141da177e4SLinus Torvaldsoverseen by Profs. Nelson Morgan and John Wawrzynek.  More information
15*50a23e6eSJustin P. Mattockis available through the Web page
16*50a23e6eSJustin P. Mattockhttp://www.jhauser.us/arithmetic/SoftFloat-2b/SoftFloat-source.txt
171da177e4SLinus Torvalds
181da177e4SLinus TorvaldsTHIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
191da177e4SLinus Torvaldshas been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
201da177e4SLinus TorvaldsTIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
211da177e4SLinus TorvaldsPERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
221da177e4SLinus TorvaldsAND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
231da177e4SLinus Torvalds
241da177e4SLinus TorvaldsDerivative works are acceptable, even for commercial purposes, so long as
251da177e4SLinus Torvalds(1) they include prominent notice that the work is derivative, and (2) they
261da177e4SLinus Torvaldsinclude prominent notice akin to these three paragraphs for those parts of
271da177e4SLinus Torvaldsthis code that are retained.
281da177e4SLinus Torvalds
291da177e4SLinus Torvalds===============================================================================
301da177e4SLinus Torvalds*/
311da177e4SLinus Torvalds
321da177e4SLinus Torvalds/*
331da177e4SLinus Torvalds-------------------------------------------------------------------------------
341da177e4SLinus TorvaldsUnderflow tininess-detection mode, statically initialized to default value.
351da177e4SLinus Torvalds(The declaration in `softfloat.h' must match the `int8' type here.)
361da177e4SLinus Torvalds-------------------------------------------------------------------------------
371da177e4SLinus Torvalds*/
381da177e4SLinus Torvaldsint8 float_detect_tininess = float_tininess_after_rounding;
391da177e4SLinus Torvalds
401da177e4SLinus Torvalds/*
411da177e4SLinus Torvalds-------------------------------------------------------------------------------
421da177e4SLinus TorvaldsRaises the exceptions specified by `flags'.  Floating-point traps can be
431da177e4SLinus Torvaldsdefined here if desired.  It is currently not possible for such a trap to
441da177e4SLinus Torvaldssubstitute a result value.  If traps are not implemented, this routine
451da177e4SLinus Torvaldsshould be simply `float_exception_flags |= flags;'.
461da177e4SLinus Torvalds
471da177e4SLinus TorvaldsScottB:  November 4, 1998
481da177e4SLinus TorvaldsMoved this function out of softfloat-specialize into fpmodule.c.
491da177e4SLinus TorvaldsThis effectively isolates all the changes required for integrating with the
501da177e4SLinus TorvaldsLinux kernel into fpmodule.c.  Porting to NetBSD should only require modifying
511da177e4SLinus Torvaldsfpmodule.c to integrate with the NetBSD kernel (I hope!).
521da177e4SLinus Torvalds-------------------------------------------------------------------------------
531da177e4SLinus Torvaldsvoid float_raise( int8 flags )
541da177e4SLinus Torvalds{
551da177e4SLinus Torvalds    float_exception_flags |= flags;
561da177e4SLinus Torvalds}
571da177e4SLinus Torvalds*/
581da177e4SLinus Torvalds
591da177e4SLinus Torvalds/*
601da177e4SLinus Torvalds-------------------------------------------------------------------------------
611da177e4SLinus TorvaldsInternal canonical NaN format.
621da177e4SLinus Torvalds-------------------------------------------------------------------------------
631da177e4SLinus Torvalds*/
641da177e4SLinus Torvaldstypedef struct {
651da177e4SLinus Torvalds    flag sign;
661da177e4SLinus Torvalds    bits64 high, low;
671da177e4SLinus Torvalds} commonNaNT;
681da177e4SLinus Torvalds
691da177e4SLinus Torvalds/*
701da177e4SLinus Torvalds-------------------------------------------------------------------------------
711da177e4SLinus TorvaldsThe pattern for a default generated single-precision NaN.
721da177e4SLinus Torvalds-------------------------------------------------------------------------------
731da177e4SLinus Torvalds*/
741da177e4SLinus Torvalds#define float32_default_nan 0xFFFFFFFF
751da177e4SLinus Torvalds
761da177e4SLinus Torvalds/*
771da177e4SLinus Torvalds-------------------------------------------------------------------------------
781da177e4SLinus TorvaldsReturns 1 if the single-precision floating-point value `a' is a NaN;
791da177e4SLinus Torvaldsotherwise returns 0.
801da177e4SLinus Torvalds-------------------------------------------------------------------------------
811da177e4SLinus Torvalds*/
821da177e4SLinus Torvaldsflag float32_is_nan( float32 a )
831da177e4SLinus Torvalds{
841da177e4SLinus Torvalds
851da177e4SLinus Torvalds    return ( 0xFF000000 < (bits32) ( a<<1 ) );
861da177e4SLinus Torvalds
871da177e4SLinus Torvalds}
881da177e4SLinus Torvalds
891da177e4SLinus Torvalds/*
901da177e4SLinus Torvalds-------------------------------------------------------------------------------
911da177e4SLinus TorvaldsReturns 1 if the single-precision floating-point value `a' is a signaling
921da177e4SLinus TorvaldsNaN; otherwise returns 0.
931da177e4SLinus Torvalds-------------------------------------------------------------------------------
941da177e4SLinus Torvalds*/
951da177e4SLinus Torvaldsflag float32_is_signaling_nan( float32 a )
961da177e4SLinus Torvalds{
971da177e4SLinus Torvalds
981da177e4SLinus Torvalds    return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF );
991da177e4SLinus Torvalds
1001da177e4SLinus Torvalds}
1011da177e4SLinus Torvalds
1021da177e4SLinus Torvalds/*
1031da177e4SLinus Torvalds-------------------------------------------------------------------------------
1041da177e4SLinus TorvaldsReturns the result of converting the single-precision floating-point NaN
1051da177e4SLinus Torvalds`a' to the canonical NaN format.  If `a' is a signaling NaN, the invalid
1061da177e4SLinus Torvaldsexception is raised.
1071da177e4SLinus Torvalds-------------------------------------------------------------------------------
1081da177e4SLinus Torvalds*/
1091da177e4SLinus Torvaldsstatic commonNaNT float32ToCommonNaN( float32 a )
1101da177e4SLinus Torvalds{
1111da177e4SLinus Torvalds    commonNaNT z;
1121da177e4SLinus Torvalds
1131da177e4SLinus Torvalds    if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
1141da177e4SLinus Torvalds    z.sign = a>>31;
1151da177e4SLinus Torvalds    z.low = 0;
1161da177e4SLinus Torvalds    z.high = ( (bits64) a )<<41;
1171da177e4SLinus Torvalds    return z;
1181da177e4SLinus Torvalds
1191da177e4SLinus Torvalds}
1201da177e4SLinus Torvalds
1211da177e4SLinus Torvalds/*
1221da177e4SLinus Torvalds-------------------------------------------------------------------------------
1231da177e4SLinus TorvaldsReturns the result of converting the canonical NaN `a' to the single-
1241da177e4SLinus Torvaldsprecision floating-point format.
1251da177e4SLinus Torvalds-------------------------------------------------------------------------------
1261da177e4SLinus Torvalds*/
1271da177e4SLinus Torvaldsstatic float32 commonNaNToFloat32( commonNaNT a )
1281da177e4SLinus Torvalds{
1291da177e4SLinus Torvalds
1301da177e4SLinus Torvalds    return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 );
1311da177e4SLinus Torvalds
1321da177e4SLinus Torvalds}
1331da177e4SLinus Torvalds
1341da177e4SLinus Torvalds/*
1351da177e4SLinus Torvalds-------------------------------------------------------------------------------
1361da177e4SLinus TorvaldsTakes two single-precision floating-point values `a' and `b', one of which
1371da177e4SLinus Torvaldsis a NaN, and returns the appropriate NaN result.  If either `a' or `b' is a
1381da177e4SLinus Torvaldssignaling NaN, the invalid exception is raised.
1391da177e4SLinus Torvalds-------------------------------------------------------------------------------
1401da177e4SLinus Torvalds*/
1411da177e4SLinus Torvaldsstatic float32 propagateFloat32NaN( float32 a, float32 b )
1421da177e4SLinus Torvalds{
1431da177e4SLinus Torvalds    flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
1441da177e4SLinus Torvalds
1451da177e4SLinus Torvalds    aIsNaN = float32_is_nan( a );
1461da177e4SLinus Torvalds    aIsSignalingNaN = float32_is_signaling_nan( a );
1471da177e4SLinus Torvalds    bIsNaN = float32_is_nan( b );
1481da177e4SLinus Torvalds    bIsSignalingNaN = float32_is_signaling_nan( b );
1491da177e4SLinus Torvalds    a |= 0x00400000;
1501da177e4SLinus Torvalds    b |= 0x00400000;
1511da177e4SLinus Torvalds    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
1521da177e4SLinus Torvalds    if ( aIsNaN ) {
1531da177e4SLinus Torvalds        return ( aIsSignalingNaN & bIsNaN ) ? b : a;
1541da177e4SLinus Torvalds    }
1551da177e4SLinus Torvalds    else {
1561da177e4SLinus Torvalds        return b;
1571da177e4SLinus Torvalds    }
1581da177e4SLinus Torvalds
1591da177e4SLinus Torvalds}
1601da177e4SLinus Torvalds
1611da177e4SLinus Torvalds/*
1621da177e4SLinus Torvalds-------------------------------------------------------------------------------
1631da177e4SLinus TorvaldsThe pattern for a default generated double-precision NaN.
1641da177e4SLinus Torvalds-------------------------------------------------------------------------------
1651da177e4SLinus Torvalds*/
1661da177e4SLinus Torvalds#define float64_default_nan LIT64( 0xFFFFFFFFFFFFFFFF )
1671da177e4SLinus Torvalds
1681da177e4SLinus Torvalds/*
1691da177e4SLinus Torvalds-------------------------------------------------------------------------------
1701da177e4SLinus TorvaldsReturns 1 if the double-precision floating-point value `a' is a NaN;
1711da177e4SLinus Torvaldsotherwise returns 0.
1721da177e4SLinus Torvalds-------------------------------------------------------------------------------
1731da177e4SLinus Torvalds*/
1741da177e4SLinus Torvaldsflag float64_is_nan( float64 a )
1751da177e4SLinus Torvalds{
1761da177e4SLinus Torvalds
1771da177e4SLinus Torvalds    return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) );
1781da177e4SLinus Torvalds
1791da177e4SLinus Torvalds}
1801da177e4SLinus Torvalds
1811da177e4SLinus Torvalds/*
1821da177e4SLinus Torvalds-------------------------------------------------------------------------------
1831da177e4SLinus TorvaldsReturns 1 if the double-precision floating-point value `a' is a signaling
1841da177e4SLinus TorvaldsNaN; otherwise returns 0.
1851da177e4SLinus Torvalds-------------------------------------------------------------------------------
1861da177e4SLinus Torvalds*/
1871da177e4SLinus Torvaldsflag float64_is_signaling_nan( float64 a )
1881da177e4SLinus Torvalds{
1891da177e4SLinus Torvalds
1901da177e4SLinus Torvalds    return
1911da177e4SLinus Torvalds           ( ( ( a>>51 ) & 0xFFF ) == 0xFFE )
1921da177e4SLinus Torvalds        && ( a & LIT64( 0x0007FFFFFFFFFFFF ) );
1931da177e4SLinus Torvalds
1941da177e4SLinus Torvalds}
1951da177e4SLinus Torvalds
1961da177e4SLinus Torvalds/*
1971da177e4SLinus Torvalds-------------------------------------------------------------------------------
1981da177e4SLinus TorvaldsReturns the result of converting the double-precision floating-point NaN
1991da177e4SLinus Torvalds`a' to the canonical NaN format.  If `a' is a signaling NaN, the invalid
2001da177e4SLinus Torvaldsexception is raised.
2011da177e4SLinus Torvalds-------------------------------------------------------------------------------
2021da177e4SLinus Torvalds*/
2031da177e4SLinus Torvaldsstatic commonNaNT float64ToCommonNaN( float64 a )
2041da177e4SLinus Torvalds{
2051da177e4SLinus Torvalds    commonNaNT z;
2061da177e4SLinus Torvalds
2071da177e4SLinus Torvalds    if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
2081da177e4SLinus Torvalds    z.sign = a>>63;
2091da177e4SLinus Torvalds    z.low = 0;
2101da177e4SLinus Torvalds    z.high = a<<12;
2111da177e4SLinus Torvalds    return z;
2121da177e4SLinus Torvalds
2131da177e4SLinus Torvalds}
2141da177e4SLinus Torvalds
2151da177e4SLinus Torvalds/*
2161da177e4SLinus Torvalds-------------------------------------------------------------------------------
2171da177e4SLinus TorvaldsReturns the result of converting the canonical NaN `a' to the double-
2181da177e4SLinus Torvaldsprecision floating-point format.
2191da177e4SLinus Torvalds-------------------------------------------------------------------------------
2201da177e4SLinus Torvalds*/
2211da177e4SLinus Torvaldsstatic float64 commonNaNToFloat64( commonNaNT a )
2221da177e4SLinus Torvalds{
2231da177e4SLinus Torvalds
2241da177e4SLinus Torvalds    return
2251da177e4SLinus Torvalds          ( ( (bits64) a.sign )<<63 )
2261da177e4SLinus Torvalds        | LIT64( 0x7FF8000000000000 )
2271da177e4SLinus Torvalds        | ( a.high>>12 );
2281da177e4SLinus Torvalds
2291da177e4SLinus Torvalds}
2301da177e4SLinus Torvalds
2311da177e4SLinus Torvalds/*
2321da177e4SLinus Torvalds-------------------------------------------------------------------------------
2331da177e4SLinus TorvaldsTakes two double-precision floating-point values `a' and `b', one of which
2341da177e4SLinus Torvaldsis a NaN, and returns the appropriate NaN result.  If either `a' or `b' is a
2351da177e4SLinus Torvaldssignaling NaN, the invalid exception is raised.
2361da177e4SLinus Torvalds-------------------------------------------------------------------------------
2371da177e4SLinus Torvalds*/
2381da177e4SLinus Torvaldsstatic float64 propagateFloat64NaN( float64 a, float64 b )
2391da177e4SLinus Torvalds{
2401da177e4SLinus Torvalds    flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
2411da177e4SLinus Torvalds
2421da177e4SLinus Torvalds    aIsNaN = float64_is_nan( a );
2431da177e4SLinus Torvalds    aIsSignalingNaN = float64_is_signaling_nan( a );
2441da177e4SLinus Torvalds    bIsNaN = float64_is_nan( b );
2451da177e4SLinus Torvalds    bIsSignalingNaN = float64_is_signaling_nan( b );
2461da177e4SLinus Torvalds    a |= LIT64( 0x0008000000000000 );
2471da177e4SLinus Torvalds    b |= LIT64( 0x0008000000000000 );
2481da177e4SLinus Torvalds    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
2491da177e4SLinus Torvalds    if ( aIsNaN ) {
2501da177e4SLinus Torvalds        return ( aIsSignalingNaN & bIsNaN ) ? b : a;
2511da177e4SLinus Torvalds    }
2521da177e4SLinus Torvalds    else {
2531da177e4SLinus Torvalds        return b;
2541da177e4SLinus Torvalds    }
2551da177e4SLinus Torvalds
2561da177e4SLinus Torvalds}
2571da177e4SLinus Torvalds
2581da177e4SLinus Torvalds#ifdef FLOATX80
2591da177e4SLinus Torvalds
2601da177e4SLinus Torvalds/*
2611da177e4SLinus Torvalds-------------------------------------------------------------------------------
2621da177e4SLinus TorvaldsThe pattern for a default generated extended double-precision NaN.  The
2631da177e4SLinus Torvalds`high' and `low' values hold the most- and least-significant bits,
2641da177e4SLinus Torvaldsrespectively.
2651da177e4SLinus Torvalds-------------------------------------------------------------------------------
2661da177e4SLinus Torvalds*/
2671da177e4SLinus Torvalds#define floatx80_default_nan_high 0xFFFF
2681da177e4SLinus Torvalds#define floatx80_default_nan_low  LIT64( 0xFFFFFFFFFFFFFFFF )
2691da177e4SLinus Torvalds
2701da177e4SLinus Torvalds/*
2711da177e4SLinus Torvalds-------------------------------------------------------------------------------
2721da177e4SLinus TorvaldsReturns 1 if the extended double-precision floating-point value `a' is a
2731da177e4SLinus TorvaldsNaN; otherwise returns 0.
2741da177e4SLinus Torvalds-------------------------------------------------------------------------------
2751da177e4SLinus Torvalds*/
2761da177e4SLinus Torvaldsflag floatx80_is_nan( floatx80 a )
2771da177e4SLinus Torvalds{
2781da177e4SLinus Torvalds
2791da177e4SLinus Torvalds    return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
2801da177e4SLinus Torvalds
2811da177e4SLinus Torvalds}
2821da177e4SLinus Torvalds
2831da177e4SLinus Torvalds/*
2841da177e4SLinus Torvalds-------------------------------------------------------------------------------
2851da177e4SLinus TorvaldsReturns 1 if the extended double-precision floating-point value `a' is a
2861da177e4SLinus Torvaldssignaling NaN; otherwise returns 0.
2871da177e4SLinus Torvalds-------------------------------------------------------------------------------
2881da177e4SLinus Torvalds*/
2891da177e4SLinus Torvaldsflag floatx80_is_signaling_nan( floatx80 a )
2901da177e4SLinus Torvalds{
2911da177e4SLinus Torvalds    //register int lr;
2921da177e4SLinus Torvalds    bits64 aLow;
2931da177e4SLinus Torvalds
2941da177e4SLinus Torvalds    //__asm__("mov %0, lr" : : "g" (lr));
2951da177e4SLinus Torvalds    //fp_printk("floatx80_is_signalling_nan() called from 0x%08x\n",lr);
2961da177e4SLinus Torvalds    aLow = a.low & ~ LIT64( 0x4000000000000000 );
2971da177e4SLinus Torvalds    return
2981da177e4SLinus Torvalds           ( ( a.high & 0x7FFF ) == 0x7FFF )
2991da177e4SLinus Torvalds        && (bits64) ( aLow<<1 )
3001da177e4SLinus Torvalds        && ( a.low == aLow );
3011da177e4SLinus Torvalds
3021da177e4SLinus Torvalds}
3031da177e4SLinus Torvalds
3041da177e4SLinus Torvalds/*
3051da177e4SLinus Torvalds-------------------------------------------------------------------------------
3061da177e4SLinus TorvaldsReturns the result of converting the extended double-precision floating-
3071da177e4SLinus Torvaldspoint NaN `a' to the canonical NaN format.  If `a' is a signaling NaN, the
3081da177e4SLinus Torvaldsinvalid exception is raised.
3091da177e4SLinus Torvalds-------------------------------------------------------------------------------
3101da177e4SLinus Torvalds*/
3111da177e4SLinus Torvaldsstatic commonNaNT floatx80ToCommonNaN( floatx80 a )
3121da177e4SLinus Torvalds{
3131da177e4SLinus Torvalds    commonNaNT z;
3141da177e4SLinus Torvalds
3151da177e4SLinus Torvalds    if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
3161da177e4SLinus Torvalds    z.sign = a.high>>15;
3171da177e4SLinus Torvalds    z.low = 0;
3181da177e4SLinus Torvalds    z.high = a.low<<1;
3191da177e4SLinus Torvalds    return z;
3201da177e4SLinus Torvalds
3211da177e4SLinus Torvalds}
3221da177e4SLinus Torvalds
3231da177e4SLinus Torvalds/*
3241da177e4SLinus Torvalds-------------------------------------------------------------------------------
3251da177e4SLinus TorvaldsReturns the result of converting the canonical NaN `a' to the extended
3261da177e4SLinus Torvaldsdouble-precision floating-point format.
3271da177e4SLinus Torvalds-------------------------------------------------------------------------------
3281da177e4SLinus Torvalds*/
3291da177e4SLinus Torvaldsstatic floatx80 commonNaNToFloatx80( commonNaNT a )
3301da177e4SLinus Torvalds{
3311da177e4SLinus Torvalds    floatx80 z;
3321da177e4SLinus Torvalds
3331da177e4SLinus Torvalds    z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 );
3341da177e4SLinus Torvalds    z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF;
33506c03cacSLennert Buytenhek    z.__padding = 0;
3361da177e4SLinus Torvalds    return z;
3371da177e4SLinus Torvalds
3381da177e4SLinus Torvalds}
3391da177e4SLinus Torvalds
3401da177e4SLinus Torvalds/*
3411da177e4SLinus Torvalds-------------------------------------------------------------------------------
3421da177e4SLinus TorvaldsTakes two extended double-precision floating-point values `a' and `b', one
3431da177e4SLinus Torvaldsof which is a NaN, and returns the appropriate NaN result.  If either `a' or
3441da177e4SLinus Torvalds`b' is a signaling NaN, the invalid exception is raised.
3451da177e4SLinus Torvalds-------------------------------------------------------------------------------
3461da177e4SLinus Torvalds*/
3471da177e4SLinus Torvaldsstatic floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b )
3481da177e4SLinus Torvalds{
3491da177e4SLinus Torvalds    flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
3501da177e4SLinus Torvalds
3511da177e4SLinus Torvalds    aIsNaN = floatx80_is_nan( a );
3521da177e4SLinus Torvalds    aIsSignalingNaN = floatx80_is_signaling_nan( a );
3531da177e4SLinus Torvalds    bIsNaN = floatx80_is_nan( b );
3541da177e4SLinus Torvalds    bIsSignalingNaN = floatx80_is_signaling_nan( b );
3551da177e4SLinus Torvalds    a.low |= LIT64( 0xC000000000000000 );
3561da177e4SLinus Torvalds    b.low |= LIT64( 0xC000000000000000 );
3571da177e4SLinus Torvalds    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
3581da177e4SLinus Torvalds    if ( aIsNaN ) {
3591da177e4SLinus Torvalds        return ( aIsSignalingNaN & bIsNaN ) ? b : a;
3601da177e4SLinus Torvalds    }
3611da177e4SLinus Torvalds    else {
3621da177e4SLinus Torvalds        return b;
3631da177e4SLinus Torvalds    }
3641da177e4SLinus Torvalds
3651da177e4SLinus Torvalds}
3661da177e4SLinus Torvalds
3671da177e4SLinus Torvalds#endif
368