Hacker News new | past | comments | ask | show | jobs | submit login

For fun, try to run this: `2 + 2 * 10%` in all calculators you have access to: on you phone, on your desktop, in kalk.

As they say, "the answer will surprise you" :)




  $ units
  You have: 2 + 2 * 10%
    Definition: 2.2
ITYM "the answer may surprise you", and in this case it did not.


I did say "in all calculators you have access too, including kalk" ;)

https://news.ycombinator.com/item?id=27336530


Performing the calculation with Soulver did not surprise me (being what I calculated in my head ahead of time):

    2 + 2 × 10% = 2.2
At the risk of admitting my ignorance, yet more interested in learning something new: should this answer (2.2) surprise me?


Wolfram Alpha and iOS also give 2.2

On MacOS the answer is 2.4

In kalk it's 2.002

On Windows it's 0.4 in simple calc, and 2 in programmer calc (and there's no % in engineering calc)


2.2 via Google[0]

> and there's no % in engineering calc

Use 0.1 instead of 10%, it has the same vibe ;)

[0] https://www.google.com/search?gbv=1&q=2%2B2%C3%9710%25&oq=&a...


What about the win32 calculator shipped with w7 and w10 ltsc?


Haha damn, didn't expect that


Android gives me 2.2


Is there an explanation for the answer in kalk? Seems buggy

It seems like an expression like "1 * 10%" in kalk is computed as if it means "1% * 10%" => "0.01 * 0.1" => "0.001"


The calculator that comes with MIUI 12 (Xiaomi phone) writes everything as you type, like you'd expect.

But, the moment you type `%`, it instead replaces `10` with `0.1`. So in the end the screen shows: 2+2x0.1 = 2.2

I guess not as surprising as you expected :-]


I did say "in all calculators you have access too, including kalk" ;)

https://news.ycombinator.com/item?id=27336530


Forth, once using fixed point and scaling 2e+2:

      2 dup 100 10 */ swap 100 * + .S 220 OK




Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: