Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Using the gnu debugger as a high-precision calculator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using the gnu debugger as a high-precision calculator
Authored by: recusant on Oct 22, '04 08:18:02PM

The question here really is why is any software company shipping a calculator desktop app that isn't using arbitrary precision algorithms.

Apple, you had an excuse when you were shipping 1MHz 6502 based machines. Any machine made in the last ten years can stand up to using an arbitrary precision engine in a calculator app.

So here's the question: Calculator has an executable called "CalcEngine" in the resource bundle. It appears to take algebraic calculations from stdin and write the answers to stdout. Anyone up to the challenge of figuring out the expected symbols and notation to creating a wrapper to bc or calc to replace Calculator.app's rather inferior brains? :-)

[ Reply to This | # ]

Replacing Calculator.app/CalcEngine with 'bc'
Authored by: recusant on Oct 22, '04 08:34:28PM

Ok, so I moved CalcEngine to CalcEngine.backup and created a symbolic link to bc called CalcEngine to see how badly it would break.

It mostly works in the Basic view, but many of the functions aren't recognized in the Advanced view. Looks like a job for sed, but it would be a lot easier with some info on the CalcEngine program itself. It also won't recognize decimals (sets the precision to 0)

Don't forget to put the original CalcEngine back if you do this experiment.

[ Reply to This | # ]

Replacing Calculator.app/CalcEngine with 'bc'
Authored by: fracai on Oct 25, '04 10:11:07AM

oh how I wish I had left my computer up when I went to work this morning.

make a script that receives stdin and writes it to a file
heck, just make a named pipe

then run tail -f on the output file or pipe
run some basic/advanced calculations and you've got the format

when I get home I'll set this up and see what I get.

---
i am jack's amusing sig file



[ Reply to This | # ]
Using the gnu debugger as a high-precision calculator
Authored by: Carnildo on Oct 25, '04 05:45:50PM

CalcEngine seems to be a more powerful calculator than the Calculator.app frontend -- it has support for such things as variables and full infix notation. Also, using "strings" on it gives some interesting results:

yacc stack overflow
fatal flex scanner internal error--no action found
fatal flex scanner internal error--end of buffer missed
fatal error - scanner input buffer overflow
flex scanner push-back overflow
out of dynamic memory in yy_create_buffer()
out of dynamic memory in yy_scan_buffer()
out of dynamic memory in yy_scan_bytes()
bad buffer in yy_scan_bytes()



[ Reply to This | # ]