void test_az_extF80_rx( void trueFunction( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), void subjFunction( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), uint_fast8_t roundingMode, bool exact ) { int count; extFloat80_t trueZ; uint_fast8_t trueFlags; extFloat80_t subjZ; uint_fast8_t subjFlags; genCases_extF80_a_init(); genCases_writeTestsTotal( testLoops_forever ); verCases_errorCount = 0; verCases_tenThousandsCount = 0; count = 10000; while ( ! genCases_done || testLoops_forever ) { genCases_extF80_a_next(); *testLoops_trueFlagsPtr = 0; trueFunction( &genCases_extF80_a, roundingMode, exact, &trueZ ); trueFlags = *testLoops_trueFlagsPtr; testLoops_subjFlagsFunction(); subjFunction( &genCases_extF80_a, roundingMode, exact, &subjZ ); subjFlags = testLoops_subjFlagsFunction(); --count; if ( ! count ) { verCases_perTenThousand(); count = 10000; } if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &genCases_extF80_a ) ) { trueFlags |= softfloat_flag_invalid; } if ( verCases_checkNaNs || ! extF80M_isNaN( &trueZ ) || ! extF80M_isNaN( &subjZ ) || extF80M_isSignalingNaN( &subjZ ) || (trueFlags != subjFlags) ) { ++verCases_errorCount; verCases_writeErrorFound( 10000 - count ); writeCase_a_extF80M( &genCases_extF80_a, " " ); writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); if ( verCases_errorCount == verCases_maxErrorCount ) break; } } } verCases_writeTestsPerformed( 10000 - count ); }
void test_a_extF80_z_ui64_x( uint_fast64_t trueFunction( const extFloat80_t *, bool ), uint_fast64_t subjFunction( const extFloat80_t *, bool ), bool exact ) { int count; uint_fast64_t trueZ; uint_fast8_t trueFlags; uint_fast64_t subjZ; uint_fast8_t subjFlags; genCases_extF80_a_init(); genCases_writeTestsTotal( testLoops_forever ); verCases_errorCount = 0; verCases_tenThousandsCount = 0; count = 10000; while ( ! genCases_done || testLoops_forever ) { genCases_extF80_a_next(); *testLoops_trueFlagsPtr = 0; trueZ = trueFunction( &genCases_extF80_a, exact ); trueFlags = *testLoops_trueFlagsPtr; testLoops_subjFlagsFunction(); subjZ = subjFunction( &genCases_extF80_a, exact ); subjFlags = testLoops_subjFlagsFunction(); --count; if ( ! count ) { verCases_perTenThousand(); count = 10000; } if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &genCases_extF80_a ) ) { trueFlags |= softfloat_flag_invalid; } if ( (trueZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) || (subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) || (trueFlags != softfloat_flag_invalid) || (subjFlags != softfloat_flag_invalid) ) { ++verCases_errorCount; verCases_writeErrorFound( 10000 - count ); writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); if ( verCases_errorCount == verCases_maxErrorCount ) break; } } } verCases_writeTestsPerformed( 10000 - count ); }
void test_a_extF80_z_f32( float32_t trueFunction( const extFloat80_t * ), float32_t subjFunction( const extFloat80_t * ) ) { int count; float32_t trueZ; uint_fast8_t trueFlags; float32_t subjZ; uint_fast8_t subjFlags; genCases_extF80_a_init(); genCases_writeTestsTotal( testLoops_forever ); verCases_errorCount = 0; verCases_tenThousandsCount = 0; count = 10000; while ( ! genCases_done || testLoops_forever ) { genCases_extF80_a_next(); *testLoops_trueFlagsPtr = 0; trueZ = trueFunction( &genCases_extF80_a ); trueFlags = *testLoops_trueFlagsPtr; testLoops_subjFlagsFunction(); subjZ = subjFunction( &genCases_extF80_a ); subjFlags = testLoops_subjFlagsFunction(); --count; if ( ! count ) { verCases_perTenThousand(); count = 10000; } if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &genCases_extF80_a ) ) { trueFlags |= softfloat_flag_invalid; } if ( verCases_checkNaNs || ! f32_isNaN( trueZ ) || ! f32_isNaN( subjZ ) || f32_isSignalingNaN( subjZ ) || (trueFlags != subjFlags) ) { ++verCases_errorCount; verCases_writeErrorFound( 10000 - count ); writeCase_a_extF80M( &genCases_extF80_a, " " ); writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); if ( verCases_errorCount == verCases_maxErrorCount ) break; } } } verCases_writeTestsPerformed( 10000 - count ); }
/*---------------------------------------------------------------------------- | Assuming the 80-bit extended floating-point value pointed to by `aSPtr' is | a NaN, converts this NaN to the common NaN form, and stores the resulting | common NaN at the location pointed to by `zPtr'. If the NaN is a signaling | NaN, the invalid exception is raised. *----------------------------------------------------------------------------*/ void softfloat_extF80MToCommonNaN( const struct extFloat80M *aSPtr, struct commonNaN *zPtr ) { if ( extF80M_isSignalingNaN( (const extFloat80_t *) aSPtr ) ) { softfloat_raiseFlags( softfloat_flag_invalid ); } zPtr->sign = signExtF80UI64( aSPtr->signExp ); zPtr->v64 = aSPtr->signif<<1; zPtr->v0 = 0; }
void test_a_i64_z_extF80( void trueFunction( int64_t, extFloat80_t * ), void subjFunction( int64_t, extFloat80_t * ) ) { int count; extFloat80_t trueZ; uint_fast8_t trueFlags; extFloat80_t subjZ; uint_fast8_t subjFlags; genCases_i64_a_init(); genCases_writeTestsTotal( testLoops_forever ); verCases_errorCount = 0; verCases_tenThousandsCount = 0; count = 10000; while ( ! genCases_done || testLoops_forever ) { genCases_i64_a_next(); *testLoops_trueFlagsPtr = 0; trueFunction( genCases_i64_a, &trueZ ); trueFlags = *testLoops_trueFlagsPtr; testLoops_subjFlagsFunction(); subjFunction( genCases_i64_a, &subjZ ); subjFlags = testLoops_subjFlagsFunction(); --count; if ( ! count ) { verCases_perTenThousand(); count = 10000; } if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { if ( verCases_checkNaNs || ! extF80M_isNaN( &trueZ ) || ! extF80M_isNaN( &subjZ ) || extF80M_isSignalingNaN( &subjZ ) || (trueFlags != subjFlags) ) { ++verCases_errorCount; verCases_writeErrorFound( 10000 - count ); writeCase_a_i64( genCases_i64_a, " " ); writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); if ( verCases_errorCount == verCases_maxErrorCount ) break; } } } verCases_writeTestsPerformed( 10000 - count ); }