Live data from Hacker News

SpeedCrunch

speedcrunch.org

111–120 of 138 posts

Re: SpeedCrunch

#111
I just press Cmd-Option-J (or F12 or whatever your browser's hotkey for that is) and the browser's devtools console opens. I can type expressions there.

Re: SpeedCrunch

#112

SpeedCrunch looks very promising, and I've used it a lot in the past. I'm sad to see that they still haven't released the order of operations bug fix [0] they made in 2017. 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...

You could make 1/2x where x = 4 evaluate to either 2 or 0.125, but either choice will have surprising results in some cases or to some people. Perhaps a better choice, especially for an interactive calculator, is to adopt partially ordered operator precedence, and reject the expression as ambiguous. Then the user can insert parentheses to disambiguate.

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.

Re: SpeedCrunch

#113

SpeedCrunch looks very promising, and I've used it a lot in the past. I'm sad to see that they still haven't released the order of operations bug fix [0] they made in 2017. 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...

This is why it is much more natural to use RPN. Solves all these problems: 1 2 / -9.8 * Or 1 2 -9.8 * /

Re: SpeedCrunch

#115
post #112

SpeedCrunch looks very promising, and I've used it a lot in the past. I'm sad to see that they still haven't released the order of operations bug fix [0] they made in 2017. 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...

You could make 1/2x where x = 4 evaluate to either 2 or 0.125, but either choice will have surprising results in some cases or to some people. Perhaps a better choice, especially for an interactive calculator, is to adopt partially ordered operator precedence, and reject the expression as ambiguous. Then the user can insert parentheses to disambiguate. In a CFG this is easy enough to express. Here's an untested and a…

> You could make 1/2x where x = 4 evaluate to either 2 or 0.125

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.

Re: SpeedCrunch

#116

Earlier quoted context omitted.

Emacs Calc (not unlike much of the rest of Emacs) is a little ... special. By default, it calculates 4/2*2 as 1, because multiplication has a higher precedence than division. https://orgmode.org/manual/Formula-syntax-for-Calc.html

You could open an issue. Seems like a reasonable idea to fix that.

Making it the opposite is wrong as well, though (PEMDAS or whatever the acronym americans learn isn't the sole truth). Just use parenthesis.

Re: SpeedCrunch

#117

I used to use this back when I mained Windows. Ever since moving primarily to Linux, and getting familiar with Emacs, Calc mode simply beats every calculator I've ever used in total functionality. However, there are certain cases where I also like to use https://insect.sh if lots of units are involved.

Google used to be excellent with units. My test is always `15 mpg in l/100km`, and Google & wolfram alpha were/are the only ones to get it right.

(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.

Re: SpeedCrunch

#118

Earlier quoted context omitted.

Except maybe that long histories create noticeable lag, that is.

Looking at its inner working seems it's uses SQLite as storing. While a few hundred entries in any SQLite DB should be a breeze to parse and show under a second, maybe the person(s) involved in this project are not that DB proficient and made some rookie mistakes. Maybe they'll notice this and improve it's history speed as well, shouldn't be a problem for any SQL developer with a bit of experience in hands.

Based on this issue https://bitbucket.org/heldercorreia/speedcrunch/issues/746 (2017) it could also be re-highlighting the entire history when a new expression is evaluated.

Re: SpeedCrunch

#119
post #112

SpeedCrunch looks very promising, and I've used it a lot in the past. I'm sad to see that they still haven't released the order of operations bug fix [0] they made in 2017. 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...

You could make 1/2x where x = 4 evaluate to either 2 or 0.125, but either choice will have surprising results in some cases or to some people. Perhaps a better choice, especially for an interactive calculator, is to adopt partially ordered operator precedence, and reject the expression as ambiguous. Then the user can insert parentheses to disambiguate. In a CFG this is easy enough to express. Here's an untested and a…

The solution is to differentiate between 2*x and 2x. / would have higher priority than *, but lower priority than conjunction

Re: SpeedCrunch

#120
post #88

I used to use this back when I mained Windows. Ever since moving primarily to Linux, and getting familiar with Emacs, Calc mode simply beats every calculator I've ever used in total functionality. However, there are certain cases where I also like to use https://insect.sh if lots of units are involved.

I use calc as well, especially practical in combination with guake ( a drop-down quake style console: https://github.com/Guake/guake ).

Is there a way to start Emacs in full window calc mode?
Post reply on HN