Correct a rounding error in RDS (rprparse).

* Bug: In <rds>, in rprparse::RdrTranslateParam(), add 0.5 before casting
    a double into a long, to avoid rounding error (truncation) for the
    returned value. Patch contributed by N. Shimizu.
      This is mainly due because when parsing the <.rds>, the sscanf may
    slighly change numbers. For example, 0.09 will be parsed as a double
    0.089999999999999997. Then later multiplations fall short when
    truncated into integers.
This commit is contained in:
Jean-Paul Chaput 2014-06-05 15:12:22 +02:00
parent 3e300dd1c3
commit dc3824d426
1 changed files with 1 additions and 1 deletions

View File

@ -653,7 +653,7 @@ long RprTranslateParam( Param )
rprerror( RPR_MULTIPLE_GRID, RprBuffer, RprCurrentLine );
}
return( ( long )Param );
return( ( long )(Param + 0.5) );
}
/*------------------------------------------------------------\