[svlug] How to do fractional exponents or arbitrary roots in the dc calculator?

Steve Litt slitt at troubleshooters.com
Mon May 30 23:50:51 PDT 2016


On Mon, 30 May 2016 17:15:07 -0700
Bob Smith <bsmith at linuxtoys.org> wrote:

> Steve Litt wrote:
> > This coming Wednesday night, Kevin Korb and I (and perhaps others)
> > are presenting on Linux calculators at the GoLUG meeting. My main
> > responsibility is the dc Reverse Polish Notation (RPN) command line
> > calculator.  
> 
> I'm tired of suffering with gnome-calculator.
> 
> Where is the GoLUG meeting?

It's about 20 miles north of Orlando Florida, same night as the SVLUG
meeting.

Because of the time difference, you can attend the GoLUG meeting, hop
on a supersonic jet, and arrive at the beginning of the SVLUG meeting.

Here's my dc program that finds all the Fibonacci numbers below 10^48,
apparently in about 10 milliseconds:

======================================================

#!/bin/sh
echo 1
echo 1
echo "1000000000000000000000000000000000000000000000000sl 1sb 1sa [lb la + la r p sa sb la  ll >x]sx lxx" | dc


======================================================

That first number in the 1 liner is 10^48, the number after which to
stop.

SteveT

Steve Litt 
May 2016 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21



More information about the svlug mailing list