Remix.run Logo
rgovostes 2 days ago

Many years ago, ~2009ish, a friend pointed out that Calculator.app was giving the wrong sign when raising a positive number to a negative exponent. It turned out to be a bug in CFNumber affecting virtually every app.

I noticed the other day that you can type "1+1 sq ft in sq in=" and macOS will helpfully autocomplete the answer: 1,694.0031 square inches. Which is completely wrong. 2 square feet is 288 square inches. It took a few minutes to solve the puzzle of what the hell it is doing.

So take caution trusting Apple's math, which naturally is up to 2x better³—for some value of x.

OptionOfT 2 days ago | parent | next [-]

Thank you for posting this.

I had the same issue with a different calculation. The answer was wrong.

I thought it looks weird because I put a space after the = and the autocomplete does not add that.

jb1991 2 days ago | parent | prev | next [-]

"1+1 sq ft in sq in="

The order of operations here is quite ambiguous. It’s not obvious even to a human reader how you would expect this to be interpreted.

rgovostes 20 hours ago | parent | next [-]

There is a perfectly cromulent grammar for a unit-aware calculator:

    <expression without units> [<unit> [in <unit>]]
    <expression with units> [in <unit>]
"1+2 feet in meters" and "1 foot + 1 meter" are both unambiguous. There is no order of operations in terms of how the units bind. The expression "1 foot + 1" is appropriately invalid.

Of course the appropriate care must be paid to interpreting "in" correctly as either a unit or a keyword.

mulmen 2 days ago | parent | prev [-]

I honestly can't tell what this would mean other than 2 square feet in inches. What's the other option?

fzzzy a day ago | parent | next [-]

(1 sq ft in sq in) + 1?

fluidcruft a day ago | parent | prev [-]

Another option could be that it's ill-posed and should just return an error.

handsclean 2 days ago | parent | prev | next [-]

> 1+1 sq ft in sq in=

Fun puzzle. Spoilers ahead:

It seems it’s considering the first 1, and not the second, to be in square meters. “(1+1) sq ft in sq in” works.

puce 2 days ago | parent [-]

1+1 sq ft = 11.76 feet^2

2 days ago | parent | prev [-]
[deleted]