FCC Calculator feedback

FCC Calculator feedback
0

#1

Hello there!!
I’ve spent quite some time with this project. Still has some bugs (not minor ones, for example, if you use it on an iPhone multiplication and division wont work).
Still I’m ready to get some feedback from over there… (promisse I will go back to that bug at some point :P)

So here is the link:
My calculator project


#2

Enter 1 /7 + 1 - 1 = * 7 and tell me what you think about that result.


#4

Yeah… not lovely. :see_no_evil:
This, I think, has to do with the way I found to deal with JavaScript decimal math awfull things by using toFix.
And probably also related with the way I use to show no zeros after comma.
I should try to find a better solution, may be I should do the math on a completely different way that could also fix the iphone bug.


#5

Found the bug, trying to work on it.
It seems for javaScript 1.1428571428571428 - 1.14285714285714279 = 0 (should be -0.00000000000000001)… it then thinks it should cut one more decimal (so not to show a 0 as the last decimal), and then the result is what you’ve seen.


#6

Ok, after trying some stuff without success, I decided to test what I should have tested in the very first place.
Go to javaScript and test your formula like this:
var testing = (1/7) + 1 - 1;
testing *= 7;
console.log(testing);
You’ll find the same result as my calculator, so, it’s just the damn floating point representation of javaScript.
I will let this be, until I have the time to start over my number representation an math so not to use javaScript flawed one.

Feel free to point me to some other bug :sweat_smile: