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
cbcb06d48a
commit
4ad40a3b45
|
@ -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