Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is also the command line version: `qalc`.

I use it since I discovered it.



Same. I was happy with `apt install calc` (I think nowadays called apcalc) for years because it does arbitrary precision and isn't as awkward as a python shell or so, but qalc is clearly a step up with support for units and solving

    $ 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


> $ qalc 10W(8h/day)1year to kWh

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?


With zsh you can call it with the noglob builtin¹, that way it doesn't try to parse the bracketed section as a globbing pattern; if that works for you, then you can simply "alias qalc='noglob qalc'" for future use.

¹ 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!


Omitted for simplicity


hmmmm. bash worked for me as was ?


I use it as my calculator app on my phone




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: