fix truncation error
To convert float to integer the truncation is performed, but the rounding is expected. Test: Add (4.9, 4.9) should return 10. Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
This commit is contained in:
parent
e0a2d20626
commit
bffd2aad57
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
int Calculator::Add (double a, double b)
|
int Calculator::Add (double a, double b)
|
||||||
{
|
{
|
||||||
return a + b;
|
return a + b + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Calculator::Sub (double a, double b)
|
int Calculator::Sub (double a, double b)
|
||||||
|
|
Loading…
Reference in New Issue