diff options
Diffstat (limited to 'source/testfloat_gen.c')
-rw-r--r-- | source/testfloat_gen.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/source/testfloat_gen.c b/source/testfloat_gen.c index 82621bb..287904e 100644 --- a/source/testfloat_gen.c +++ b/source/testfloat_gen.c @@ -1,12 +1,12 @@ /*============================================================================ -This C source file is part of TestFloat, Release 3b, a package of programs for +This C source file is part of TestFloat, Release 3c, a package of programs for testing the correctness of floating-point arithmetic complying with the IEEE Standard for Floating-Point, by John R. Hauser. -Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of -California. All rights reserved. +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 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,8 +94,10 @@ int main( int argc, char *argv[] ) #endif float32_t (*trueFunction_abz_f32)( float32_t, float32_t ); bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t ); +#ifdef FLOAT64 float64_t (*trueFunction_abz_f64)( float64_t, float64_t ); bool (*trueFunction_ab_f64_z_bool)( float64_t, float64_t ); +#endif #ifdef EXTFLOAT80 void (*trueFunction_abz_extF80)( @@ -149,7 +151,7 @@ int main( int argc, char *argv[] ) " -level <num> --Testing level <num> (1 or 2).\n" " * -level 1\n" " -n <num> --Generate <num> test cases.\n" -" -forever --Generate test cases indefinitely (implies `-level 2').\n" +" -forever --Generate test cases indefinitely (implies '-level 2').\n" #ifdef EXTFLOAT80 " -precision32 --For extF80, rounding precision is 32 bits.\n" " -precision64 --For extF80, rounding precision is 64 bits.\n" @@ -160,6 +162,10 @@ int main( int argc, char *argv[] ) " -rmin --Round to minimum (down).\n" " -rmax --Round to maximum (up).\n" " -rnear_maxMag --Round to nearest/maximum magnitude (nearest/away).\n" +#ifdef FLOAT_ROUND_ODD +" -rodd --Round to odd (jamming). (For rounding to an integer\n" +" value, rounds to minimum magnitude instead.)\n" +#endif " -tininessbefore --Detect underflow tininess before rounding.\n" " * -tininessafter --Detect underflow tininess after rounding.\n" " * -notexact --Rounding to integer is not exact (no inexact\n" @@ -189,7 +195,9 @@ int main( int argc, char *argv[] ) " f16 --Binary 16-bit floating-point (half-precision).\n" #endif " f32 --Binary 32-bit floating-point (single-precision).\n" +#ifdef FLOAT64 " f64 --Binary 64-bit floating-point (double-precision).\n" +#endif #ifdef EXTFLOAT80 " extF80 --Binary 80-bit extended floating-point.\n" #endif @@ -266,6 +274,10 @@ int main( int argc, char *argv[] ) || ! strcmp( argPtr, "rnearest_maxMag" ) ) { roundingMode = softfloat_round_near_maxMag; +#ifdef FLOAT_ROUND_ODD + } else if ( ! strcmp( argPtr, "rodd" ) ) { + roundingMode = softfloat_round_odd; +#endif } else if ( ! strcmp( argPtr, "tininessbefore" ) ) { softfloat_detectTininess = softfloat_tininess_beforeRounding; } else if ( ! strcmp( argPtr, "tininessafter" ) ) { @@ -305,11 +317,13 @@ int main( int argc, char *argv[] ) ! strcmp( argPtr, "f32" ) || ! strcmp( argPtr, "float32" ) ) { functionCode = TYPE_F32; +#ifdef FLOAT64 goto absorbArg; } else if ( ! strcmp( argPtr, "f64" ) || ! strcmp( argPtr, "float64" ) ) { functionCode = TYPE_F64; +#endif #ifdef EXTFLOAT80 goto absorbArg; } else if ( @@ -402,6 +416,7 @@ int main( int argc, char *argv[] ) case TYPE_F32_3: gen_abc_f32(); break; +#ifdef FLOAT64 case TYPE_F64: gen_a_f64(); break; @@ -411,6 +426,7 @@ int main( int argc, char *argv[] ) case TYPE_F64_3: gen_abc_f64(); break; +#endif #ifdef EXTFLOAT80 case TYPE_EXTF80: gen_a_extF80(); @@ -443,9 +459,11 @@ int main( int argc, char *argv[] ) case UI32_TO_F32: gen_a_ui32_z_f32( ui32_to_f32 ); break; +#ifdef FLOAT64 case UI32_TO_F64: gen_a_ui32_z_f64( ui32_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case UI32_TO_EXTF80: gen_a_ui32_z_extF80( ui32_to_extF80M ); @@ -464,9 +482,11 @@ int main( int argc, char *argv[] ) case UI64_TO_F32: gen_a_ui64_z_f32( ui64_to_f32 ); break; +#ifdef FLOAT64 case UI64_TO_F64: gen_a_ui64_z_f64( ui64_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case UI64_TO_EXTF80: gen_a_ui64_z_extF80( ui64_to_extF80M ); @@ -485,9 +505,11 @@ int main( int argc, char *argv[] ) case I32_TO_F32: gen_a_i32_z_f32( i32_to_f32 ); break; +#ifdef FLOAT64 case I32_TO_F64: gen_a_i32_z_f64( i32_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case I32_TO_EXTF80: gen_a_i32_z_extF80( i32_to_extF80M ); @@ -506,9 +528,11 @@ int main( int argc, char *argv[] ) case I64_TO_F32: gen_a_i64_z_f32( i64_to_f32 ); break; +#ifdef FLOAT64 case I64_TO_F64: gen_a_i64_z_f64( i64_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case I64_TO_EXTF80: gen_a_i64_z_extF80( i64_to_extF80M ); @@ -537,9 +561,11 @@ int main( int argc, char *argv[] ) case F16_TO_F32: gen_a_f16_z_f32( f16_to_f32 ); break; +#ifdef FLOAT64 case F16_TO_F64: gen_a_f16_z_f64( f16_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case F16_TO_EXTF80: gen_a_f16_z_extF80( f16_to_extF80M ); @@ -616,9 +642,11 @@ int main( int argc, char *argv[] ) gen_a_f32_z_f16( f32_to_f16 ); break; #endif +#ifdef FLOAT64 case F32_TO_F64: gen_a_f32_z_f64( f32_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case F32_TO_EXTF80: gen_a_f32_z_extF80( f32_to_extF80M ); @@ -677,6 +705,7 @@ int main( int argc, char *argv[] ) break; /*-------------------------------------------------------------------- *--------------------------------------------------------------------*/ +#ifdef FLOAT64 case F64_TO_UI32: gen_a_f64_z_ui32_rx( f64_to_ui32, roundingMode, exact ); break; @@ -753,6 +782,7 @@ int main( int argc, char *argv[] ) gen_ab_f64_z_bool: gen_ab_f64_z_bool( trueFunction_ab_f64_z_bool ); break; +#endif /*-------------------------------------------------------------------- *--------------------------------------------------------------------*/ #ifdef EXTFLOAT80 @@ -776,9 +806,11 @@ int main( int argc, char *argv[] ) case EXTF80_TO_F32: gen_a_extF80_z_f32( extF80M_to_f32 ); break; +#ifdef FLOAT64 case EXTF80_TO_F64: gen_a_extF80_z_f64( extF80M_to_f64 ); break; +#endif #ifdef FLOAT128 case EXTF80_TO_F128: gen_a_extF80_z_f128( extF80M_to_f128M ); @@ -851,9 +883,11 @@ int main( int argc, char *argv[] ) case F128_TO_F32: gen_a_f128_z_f32( f128M_to_f32 ); break; +#ifdef FLOAT64 case F128_TO_F64: gen_a_f128_z_f64( f128M_to_f64 ); break; +#endif #ifdef EXTFLOAT80 case F128_TO_EXTF80: gen_a_f128_z_extF80( f128M_to_extF80M ); @@ -911,9 +945,9 @@ int main( int argc, char *argv[] ) /*------------------------------------------------------------------------ *------------------------------------------------------------------------*/ optionError: - fail( "`%s' option requires numeric argument", *argv ); + fail( "'%s' option requires numeric argument", *argv ); invalidArg: - fail( "Invalid argument `%s'", *argv ); + fail( "Invalid argument '%s'", *argv ); } |