There is also the command line version: `qalc`.
I use it since I discovered it.
I use it since I discovered it.
$ calc 2^x=4
x is undefined
$ qalc 2^x=4
((2^x) = 4) = (x = 2)
I used the above for determining after how many years a given inflation rate doubles a price (1.03^x=2)I think my most recent real-world application for units calculation was about how much energy a device uses in kWh after a year, given that it draws 10W during office hours:
$ qalc 10W*(8h/day)*1year to kWh
(10 * watt) * ((8 * hour) / day) * (1 * year) = 29.22 kW*h
It even does time calculations: 13:37-08:00 tells you that you've been working for about 5.6 hours.I don't know why this isn't the universally used command-line calculator. I have it on my phone as well via a Debian subsystem and it's the best
Question: why didn't you need quotes around the first expression? Both Zsh and Bash error on that command without quotes. Are you using nushell?
¹ https://zsh.sourceforge.io/Doc/Release/Shell-Grammar.html#Pr...
$ qalc 10W*(8h/day)*1year to kWh
zsh: bad pattern: 10W*(8h/day)*1year
$:1 noglob qalc 10W*(8h/day)*1year to kWh
(10 watts) × (8 hours/day) × (1 year) = 29.22 kW·h
Amazing. I use qalc frequently and you just improved my life, thank you!