Commit Graph

5 Commits

Author SHA1 Message Date
rhinemann ad82668fad
add a multiplication operation
Add a member-function which performs multiplication of two float point
digits.

Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2024-10-10 20:05:02 +03:00
Sergii Piatakov ef3331a870
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>
2024-10-10 20:04:51 +03:00
Sergii Piatakov e0a2d20626 improve calculation accuracy
Allow using float point arguments to avoid truncation.

Test: Add (4.9, 4.9) should return 10.
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>

formatting: use tabs instead of spaces

Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2024-10-10 18:33:56 +03:00
Sergii Piatakov 976f6913db add a subtraction operation
Add member-function which performs a subtraction in terms of
an addition.

Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-11-15 15:17:29 +02:00
Sergii Piatakov 997217087b basic implementation
Introduce the `Calculator` class with single member-function which
performs an addition.

Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
2018-11-15 15:07:05 +02:00