SpeedCrunch
speedcrunch.org
speedcrunch.org
His blog post elicited several rapid responses from developers taking his PyQt-based mockup and turning it into a 'real' application ([2], [3]). One of those was Ariya Hidayat's "SpeedCrunch", which has been actively maintained up to the present day. I can't find Ariya's original 2004 announcement, I think the original link was http://ariya.pandu.org/blog/archives/2004/10/calculator-feve... but that's dead now.
But it's really neat to see how this all started from a day or two of hacking on a solution to a simple problem.
[1] https://ralsina.me/stories/33.html [2] https://ralsina.me/weblog/posts/P245.html [3] https://ralsina.me/weblog/posts/P247.html
``` (6 Mbit / s) × 1.5 h GB = 4.05 GB ```
Love that. Thanks the recommendation.
Wow. That's actually quite bad.
I think there's also some confusion about whether the / symbol is actually being used as a single line equivalent to a fraction, which might introduce some ambiguity? I forget. The number of ways that people can misunderstand things is infinite, so it can be hard to keep track.
Anyway, parentheses are cheap and misunderstandings, even when the other party ought to take the blame, can be expensive, so I've taken up the habit of being generous with the things.
emacs -f full-calc(Just tried, and it works again in Google, after not working for a few years)
edit: Spotlight now has it as well. Congratulations to Apple & I need to move the goalpost.
I like the UI, too, for being simple but very much functional without getting in my way. And it supports a persistent history across sessions, which I also like.
SpeedCrunch does some operations in an order most people wouldn't expect. For example, SpeedCrunch says 1/2(-9.8) = -0.05102040816326530612
[0] - https://bitbucket.org/heldercorreia/speedcrunch/commits/ac49...
a/b(c) = a/b*c = (a/b)*c
Since SpeedCrunch only accepts input in a single line, this would be the least unexpected way to interpret the expression, and consistent with how graphing calculators operate.A horizontal fraction bar, which SpeedCrunch does not support (since it only accepts single-line input), implies parentheses around the numerator and denominator. For example:
ax
-- = (ax)/(by) = (a*x)/(b*y)
by
compared to ax/by = a*x/b*y = ((a*x)/b)*y
(If the above is not displayed correctly, please view this comment on the HN website.)Implicit multiplication is a point of frequent confusion:
- https://www.nytimes.com/2019/08/05/science/math-equation-pem...
- https://www.themathdoctors.org/order-of-operations-implicit-...
To guarantee that the expression does not get misinterpreted, the person writing the expression should always add parentheses/brackets and explicit multiplication signs, or use horizontal division bars where possible, to make the expression unambiguous.
avoids this entirely.
or if you wanna be really fkn nerdy:
∕, instead of /
SpeedCrunch and other calculator apps still need to have an unambiguous way of interpreting the expression when the user types or pastes in a slash. The apps could convert slashes to division signs before displaying them on the screen, since that's how the symbols should be interpreted. This is how GNOME Calculator resolves the ambiguity.
Both answers are completely, 100% correct according to the operator precedence table in their manuals. I also have a Casio fx-83MS and fx-991ES, both give 1 as the answer.
Others I have are a Casio fx-570CD and a Casio statistical calculator I don't remember the model of, neither of which support implicit multiplication, and a SwissMicros DM42, which is RPN and doesn't have to deal with operator precedence.
I don't even know why I have half of these...
Implicit multiplication first: 1/2x = 1/(2x); Conventional: 1/2x = (1/2)x; Adaptive: 1/2x = 1/(2x); 1/2 x = (1/2)x
So their answer is to just ask the user what to do! It won me over with that.
(* (/ a b) c)
and not: (/ a (* b c))
It's very ambiguous, though. No scientist would ever write expressions like that. 1/3x
is likely to be understood as 1/(3*x), because otherwise it would’ve been written like x/3. If that’s true, then so surely 1/3(x)
should be the same, right?Smarter people than I have argued both sides of this, and I don’t have a strong opinion except to use parentheses if there’s any possible ambiguity. Just saying, I totally understand why you’d come to that conclusion, and I probably would too.
Say again that you have 1/3x. This is implicitly stating 1/3x. However, no parenthesis are used, and multiplication & division are on the same level in the order of operations, so the expression gets evaluated sequentially from left to right.
If you have 1/3(9.8), evaluating the parenthesis gives you 9.8. So you now have 1/39.8. The expression inside the parenthesis gets evaluated first, then the final result is just multiplied by whatever precedes or succeeds the parenthetical if no other term is given. So 1/3+(9.8) would obviously evaluate to be 1/3+9.8.
Again, if the parenthesis aren't enclosing operations within themselves, then they shouldn't modify the way you'd evaluate the expression. I've had this problem with SpeedCrunch many times over and wish they would update it. Still the best desktop calculator IMO.
edit: a word
In a CFG this is easy enough to express. Here's an untested and at any rate incomplete CFG demonstrating the technique:
expr ::= term | term "+" expr | term "-" expr
term ::= quotient | product
quotient ::= atom "/" atom | atom "/" quotient
product ::= atom product | atom "*" product | atom
atom ::= number | variable | "-" atom | "(" expr ")"
But typical parser generators don't give you an easy way to provide a useful error message there.That version of the grammar, btw, avoids left recursion, so it ought to work as a PEG, but at the cost of the wrong associativity for "/" and "-". You either need to use left recursion or restructure the syntax tree afterwards.
Ouch, you just made me think that if I see this equation just "horizontally" like it's presented here, I would say 2. But if I imagine it like you would write it on paper, I would answer 0.125.
It also has a persistent history, variables, functions, base conversion, etc. I guess it doesn't have unit conversion or a math library, but it's a great programmers calculator.
The best part is its available anywhere, on any computer, in any web browser without installing anything.
SC: 5+8 Enter [4 keys, 1 shift]
Calc: 5 RET 8 + [4 keys, 1 shift]
SC: 5*(113+23) Enter [11 keys, 3 shifts]
Calc: 5 RET 113 RET 23 + * [10 keys, 1 shift]
SC: 7*ans Enter [6 keys, 1 shift]
Calc: 7 * [2 keys, 1 shift]
SC: sqrt(1231+41) Enter [14 keys, 3 shift]
Calc: 1231 RET 41 + Q [9 keys, 1 shift]
Maybe it’s more efficient than clicking buttons with a mouse but it doesn’t feel more efficient than the calculator I already use, nor does it seem to be better integrated with the software I use. It doesn’t even seem more efficient than the scientific calculator I used in high school.I think I’m put off more by the lack of graphing and (as far as I could tell skimming their site) array/vector/matrix functions, which are the main things I do with Calc.
- single buttons for common operations like +, * or sqrt
- no shifted parentheses
- display-style input of fractions and exponential so you got some visual clue if your brackets weren’t totally wrong
- single (sometimes shifted) buttons for functions like cos/tan/arcsin/…
- specialised shift operators which mostly meant inverse or hyperbolic
GNU Calc has most of these (+ and * are still shifted but all common operations are shifted. Parentheses are not used because of RPN. Display-style (‘big’) presentation is optional but ugly ascii art. Press H for hyperbolic, I for inverse).
I think gnu Calc is lacking a bit in entry of algebraic expressions but I don’t think speed crunch is better. I’d like to see something that let you place a ‘(‘ somewhere ‘backwards’, or in other words a feature for ‘I would like to parenthetical use some of the past expressions. Please let me interactively choose them without fiddling with cursor movement commands.’
https://github.com/shawwn/scrap/blob/master/math
#!/bin/sh
scale=4 # results will print to the 4th decimal
echo "scale=$scale; $@" | bc -l
It just yeets all its arguments into bc -l, so you can run math 1+2-3 or math '(1024 - 7)*10' or whatever else you want. I even use it in other shell scripts, since bash's math facilities are rather limited and inconsistent across sh vs bash. :~$ echo $(((3+4)*5))
35
:~$ echo $(((3+4)*5/1024))
0
:~$ math '((3+4)*5/1024)'
.0341
It has all the precision you want, as long as you only want results up to the 4th decimal.It's surprising how much I use it. I find myself absentmindedly typing out math 220*1024*1024 while talking to people in meetings (what, you don't have meetings where it's crucial to know how quickly 220MB can be transferred?) and like thousands of other situations.
Meanwhile, funny story: I bought an iPad recently, and discovered that it's a delightful way to pass the time while shopping. You can stick it in your cart and pull up 3blue1brown and zone out while getting your pineapples. So I was doing that, and I went to reach for the calculator app to figure something out, and discovered that there is no calculator on iPads.
The punchline is that if you want a calculator on an iPad, it'll either cost you $5 or your soul: https://i.imgur.com/CJsDtB0.jpg
Someone please make SpeedCrunch, but MsPaint. I miss MsPaint every day. There's an OS X app called Paintbrush which is similar, but unfortunately quite buggy and somehow even more limited in certain respects. Being able to just paste a screenshot and draw a red circle within 5 seconds is something that I wish we could do in 2022. Nay, I say that it's our right as programmers to be able to do that. </rallying cry>
EDIT: formatting. TIL you can backslash-escape asterisks on HN.
I’m like you. On Linux there’s KolourPaint that does the job, but on macOS I never found any desktop app that does what I want. In the browser, there’s this clone [1] that mimicks all the features of the original one. You can "open" a file, "save" it, and everything in the meantime is saved in local storage.
[1]: https://jspaint.app/
Wait, what!? I have never used an iPad but this just floors me.
Imagine going to an Apple store, asking about the new iPad, listening to the pitch, nodding along as they play fruit ninja and draw a smiley face with a stylus and then asking "what's the 12th digit of the square root of two?".
How can it not have a calculator? I mean, what?
I'm old and jaded and consumer grade technology hasn't amazed me or made my life better in well over a decade but this is a whole new level.
I saw an issues thread from 2017 (https://bitbucket.org/heldercorreia/speedcrunch/issues/702/s...) that discussed porting to iOS but nothing since.
What are the GPL implications of porting this to Swift even with putting all source on a public GitHub/BitBucket repo because of the App Store?
I was recently doing some (silly) combinatorical math, where I wanted to know factorial(400_000) and SpeedCrunch happily produced the answer immediately. Incredibly satisfied.
I only use it to display numbers as hex and binary [1] but I'm sure it can be useful in many other ways.
[1]: https://github.com/L-P/dotfiles/blob/39ac8d5849a593ef1633ed8...
On Android, so far, I prefer Calculator++ - it supports complex numbers (not that I need those, but sqrt(-1) returns i) and has fairly capable graphing.
And the .dmg file that has the retina fix is here: https://github.com/gagarcr/speedcrunch-nightlies/releases
Hopefully this helps!
I often have to do many simple calculations (adding numbers from a pdf,...) and having full history and being able to keep speedcrunch over the other windows is perfect. I also increased font-size dramatically to improve readability on big screens.
Sure, there are more advanced tools. But the simplicity and lightness on ressources is what makes it my go-to calculator.
if [ $(xdotool search --name "calc repl") ]; then
xdotool search --name "calc repl" windowraise
else
xfce4-terminal \
--title="calc repl" \
--color-bg=#123 \
--color-text=#fec \
--hide-scrollbar \
--font="Deja Vu Sans Mono 14px" \
--geometry 40x14 \
--execute node -i -e "$JSREPL"
fi
($JSREPL just contains some extra functions that I want in a calculator)I can easily go back to previous calculations and results, define vars, run loops whatevs. Having it on a key combo and launching the terminal with a distinct text/bg color really makes a difference. It also launches faster than most other calculators I tried. For my purposes (non-scientific, mostly programming stuff), it's been great.
$ node -i
> 2**54+2
18014398509481984
> 3-3.01
-0.009999999999999787
Other calculators such as calc [1] don't have these issues(Edit: The HTML export feature even preserves the color theme. It's a web publishing tool now! Hahaha)
Thank you to the authors for working on it. Time to send them a donation!
(I'd report a bug, but a calculator program making itself unusable in less than a minute with steps I can't precisely recreate kinda kills my enthusiasm for that process.)
It's written in Rust ;-)
[0] - https://appcenter.elementary.io/com.github.parnold-x.nasc/
(3(7^204+7^202+7^200)+7(3^204+3^200)-210) mod 10
in the calculator that comes with linux and get the right result (which is 7), but speedcrunch overflows and outputs 0. I've set the result format to fixed decimal and precision to 50 digits, but that doesn't seem to make a difference.
Edit: Just tried it with insect, which also gets it wrong.
What I like the most is the seamless integration of different notation styles, mainly using commas and points as decimal separators.
Learning SpeedCrunch is easy if you're already comfortable with single-line calculators. It has autocomplete that will help learn some of the SpeedCrunch specific units. For example, year_julian vs year_tropical, gallon_US vs gallon_UK are slightly different.
:)
echo $((expression))
It will treat values as integers by default I think, so $((1/2)) evaluates to zero. But $((1./2)) treats the 1. as something else, I guess probably a float, and so produces .5.