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:
parent
3e300dd1c3
commit
dc3824d426
|
@ -653,7 +653,7 @@ long RprTranslateParam( Param )
|
|||
rprerror( RPR_MULTIPLE_GRID, RprBuffer, RprCurrentLine );
|
||||
}
|
||||
|
||||
return( ( long )Param );
|
||||
return( ( long )(Param + 0.5) );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
|
|
Loading…
Reference in New Issue