From 7755a04bd7c8e666a04cc5daa3cf70daedb54b23 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 28 Jul 2017 09:57:39 -0700 Subject: [PATCH] Add rounding to naive number. --- src/org/nwapw/abacus/number/NaiveNumber.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/org/nwapw/abacus/number/NaiveNumber.java b/src/org/nwapw/abacus/number/NaiveNumber.java index b201a91..0b6d3d2 100755 --- a/src/org/nwapw/abacus/number/NaiveNumber.java +++ b/src/org/nwapw/abacus/number/NaiveNumber.java @@ -92,7 +92,8 @@ public class NaiveNumber implements NumberInterface { } public String toString(){ - return Double.toString(value); + double shiftBy = Math.pow(10, 10); + return Double.toString(Math.round(value * shiftBy) / shiftBy); } }