Skip to content

Commit 94058f6

Browse files
committed
Partially revert "oops, abs() != fabs() - and DBL_EPSILON isn't what I thought it was"
Old commit ae8d89f.
1 parent 544d004 commit 94058f6

4 files changed

Lines changed: 198 additions & 200 deletions

File tree

src/express/expparse.y

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,15 +1587,14 @@ literal(A) ::= TOK_INTEGER_LITERAL(B).
15871587
}
15881588
literal(A) ::= TOK_REAL_LITERAL(B).
15891589
{
1590-
/* if rVal (a double) is nonzero and <= the smallest positive float, print a warning */
1591-
if( ( fabs( B.rVal ) <= nextafterf( 0.0, 1.0 ) )
1592-
&& ( fabs( B.rVal ) > 0 ) ) {
1590+
/* if rVal (a double) is nonzero and has magnitude <= the smallest non-denormal float, print a warning */
1591+
if( ( fabs( B.rVal ) <= FLT_MIN ) && ( fabs( B.rVal ) > 0 ) ) {
15931592
Symbol sym;
15941593
sym.line = yylineno;
15951594
sym.filename = current_filename;
15961595
ERRORreport_with_symbol(ERROR_warn_small_real, &sym, B.rVal );
15971596
}
1598-
if( fabs( B.rVal ) < nextafter( 0.0, 1.0 ) ) {
1597+
if( fabs( B.rVal ) < DBL_MIN ) {
15991598
A = LITERAL_ZERO;
16001599
} else {
16011600
A = EXPcreate_simple(Type_Real);

src/express/express.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ void EXPRESSinitialize( void ) {
522522
ERROR_file_unreadable = ERRORcreate( "Could not read file %s: %s", SEVERITY_ERROR );
523523
ERROR_file_unwriteable = ERRORcreate( "Could not write file %s: %s", SEVERITY_ERROR );
524524
ERROR_warn_unsupported_lang_feat = ERRORcreate( "Unsupported language feature (%s) at %s:%d", SEVERITY_WARNING );
525-
ERROR_warn_small_real = ERRORcreate( "REAL with extremely small magnitude may be interpreted as zero on some "
526-
"platforms or by other parsers - abs(%f) <= FLT_EPSILON", SEVERITY_WARNING );
525+
ERROR_warn_small_real = ERRORcreate( "REALs with extremely small magnitude may be interpreted as zero by other EXPRESS parsers "
526+
"(IEEE 754 float denormals are sometimes rounded to zero) - fabs(%f) <= FLT_MIN.", SEVERITY_WARNING );
527527

528528
OBJcreate( OBJ_EXPRESS, EXPRESS_get_symbol, "express file", OBJ_UNUSED_BITS );
529529

0 commit comments

Comments
 (0)