Show HN: Notepad Style Online Calculator
type-calc.herokuapp.com
type-calc.herokuapp.com
The most difficult thing for me was the design. Once I had a design in my head it was also very hard to realize it using CSS. I simply don't get CSS. The final version looks a lot less snazzy than I had imagined.
Please let me know what you think of it!
I was playing around with weird/edge case inputs and came across this one that gives a strange result: `(200000 * 23323 * 2423 * 4223 + 30%)` => `62048638409419990,62048638409420000,62048638409419990,62048638409420000` I don't know if this is some sort of thousands-separator or a list of numbers, but I'd be interested to learn how the parser sees this. For reference, both `(200000 * 23323 * 2423 * 4223) + 30%` and `(200000 * 23323 * 2423 * (4223 + 30%))` give sensible results (once you get how the percent operator works).
The two ways are:
- (200000 * 23323 * 2423 * 4223) + 30%
- (200000 * 23323 * 2423 * (4223 + 30%))
Now I'm not sure how to fix this.
Generally I'd enter an expression, look at the result, then stop. If I wanted to run multiple things I'd use a repl, which would let me copy/paste.
That said it might be useful if you allowed variables to be defined, I updated my own little repl/calculator to allow that recently and found it very useful:
calc> rent = 700.00
700
calc> fee = 92.00
92
calc> ( rent - fee ) * 12
7296
Allowing that makes your multiline input more useful, although I guess you would need to decide if you'd recalculate all lines using a given variable if it's value changed ..Originally I wrote this purely to try out nearley.js, I was very intrigued by that library. Then I added the IP addresses function because I need to convert IPs to ints fairly frequently in my work. For that the line evaluation made sense.
I didn't know nearley.js. Maybe I can extend my own project to make more natural calculations.