File tree Expand file tree Collapse file tree 2 files changed +37
-5
lines changed
Expand file tree Collapse file tree 2 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -1463,7 +1463,7 @@ assert result("ATANH") =~ expr("
14631463 - 6.08698087464190136361e-01*atanh( - 5.4321e-01)
14641464" )
14651465*--# ] evaluate_atanh :
1466- *--# [ strictrounding :
1466+ *--# [ strictrounding_1 :
14671467# StartFloat 6d
14681468CFunction f;
14691469Local F1 = 1.23456789e-4+f(1.0)+f(1.0000001);
@@ -1482,7 +1482,37 @@ Print;
14821482assert succeeded?
14831483assert result(" F1" ) =~ expr(" 1.23457e-04 + f(1.0e+00) + f(1.0e+00)" )
14841484assert result(" F2" ) =~ expr(" 1.235e-04 + 2*f(1.0e+00)" )
1485- *--# ] strictrounding :
1485+ *--# ] strictrounding_1 :
1486+ *--# [ strictrounding_2 :
1487+ # StartFloat 20b
1488+ CFunction f;
1489+ Local F = 1.1e-4;
1490+ StrictRounding 5b;
1491+ .sort
1492+
1493+ # EndFloat
1494+ # StartFloat 40d
1495+ Print;
1496+ .end
1497+ # pend_if wordsize == 2
1498+ assert succeeded?
1499+ assert result(" F" ) =~ expr(" 1.10626220703125e-04" )
1500+ *--# ] strictrounding_2 :
1501+ *--# [ strictrounding_error:
1502+ # -
1503+ StrictRounding;
1504+ # StartFloat 10d
1505+ StrictRounding 5;
1506+ StrictRounding d5;
1507+ StrictRounding 5 d;
1508+ .end
1509+ # pend_if wordsize == 2
1510+ runtime_error?(" Illegal attempt for strict rounding without activating floating point numbers." )
1511+ runtime_error?(" Forgotten #startfloat instruction?" )
1512+ runtime_error?(" Illegal argument(s) in StrictRounding statement: ''" )
1513+ runtime_error?(" Illegal argument(s) in StrictRounding statement: 'd5'" )
1514+ runtime_error?(" Illegal argument(s) in StrictRounding statement: ',d'" )
1515+ *--# ] strictrounding_error :
14861516*--# [ chop :
14871517# StartFloat 15d
14881518# StartFloat 15d
Original file line number Diff line number Diff line change @@ -1320,15 +1320,17 @@ int CoStrictRounding(UBYTE *s)
13201320 if ( * s == 0 ) {
13211321 /* No subkey, which means round to default precision */
13221322 x = AC .DefaultPrecision - AC .MaxWeight - 1 ;
1323- Add4Com (TYPESTRICTROUNDING ,x ,2 );
1324- return (0 );
1323+ base = 2 ;
13251324 }
1326- if ( FG .cTable [* s ] == 1 ) { /* number */
1325+ else if ( FG .cTable [* s ] == 1 ) { /* number */
13271326 ParseNumber (x ,s )
13281327 if ( tolower (* s ) == 'd' ) { base = 10 ; s ++ ; } /* decimal base */
13291328 else if ( tolower (* s ) == 'b' ){ base = 2 ; s ++ ; } /* binary base */
13301329 else goto IllPar ; /* invalid base specification */
13311330 }
1331+ else {
1332+ goto IllPar ;
1333+ }
13321334 while ( * s == ' ' || * s == ',' || * s == '\t' ) s ++ ;
13331335
13341336 /* Check for invalid arguments */
You can’t perform that action at this time.
0 commit comments