[comp.unix.questions] Calculators

roberts@icst-cmr.arpa (John Roberts) (02/26/88)

Are there ANY calculator utilities that will run under Unix (4.3)
that support FLOATING POINT operations? Maybe even transcendental
functions? I'm tired of the ones that only work with integers.

Thanks in advance for any assistance.
                                                  John Roberts
                                                  roberts@icst-cmr.ARPA

mesard@bbn.com (Wayne Mesard) (02/27/88)

From article <12002@brl-adm.ARPA>, by roberts@icst-cmr.arpa (John Roberts):
> 
> Are there ANY calculator utilities that will run under Unix (4.3)
> that support FLOATING POINT operations? Maybe even transcendental
> functions? I'm tired of the ones that only work with integers.
> 
> Thanks in advance for any assistance.
>                                                   John Roberts
>                                                   roberts@icst-cmr.ARPA

I just submitted a command line calculator program to comp.sources.unix.
It should be posted in a couple of weeks (as soon as it makes it's way
up the r$.queue :-)



-- 
Wayne Mesard   | "The people of the North End don't like the city telling us
MESARD@BBN.COM | where and when we can and can't park our cars.  So as soon
BBN Labs,      | as they fix the meters, we jam em and break em, and paint em.
Cambridge, MA  | We call it a local referendum."  -JS

lm@arizona.edu (Larry McVoy) (02/27/88)

In article <12002@brl-adm.ARPA> roberts@icst-cmr.arpa (John Roberts) writes:
>
>Are there ANY calculator utilities that will run under Unix (4.3)
>that support FLOATING POINT operations? Maybe even transcendental
>functions? I'm tired of the ones that only work with integers.

Script started on Fri Feb 26 16:44:52 1988
$ bc
scale=4
1/2
.5000
.*10.2345
5.1172
^D
script done on Fri Feb 26 16:45:33 1988
-- 

Larry McVoy	lm@arizona.edu or ...!{uwvax,sun}!arizona.edu!lm
		Use the force - read the source.

mike@turing.UNM.EDU (Michael I. Bushnell) (02/27/88)

In article <12002@brl-adm.ARPA> roberts@icst-cmr.arpa (John Roberts) writes:

>Are there ANY calculator utilities that will run under Unix (4.3)
>that support FLOATING POINT operations? Maybe even transcendental
>functions? I'm tired of the ones that only work with integers.

Try bc(1).  If the first thing you say is "scale=10", then you get
10 digit precision.  You can set scale pretty high; I am not sure
what the upper limit is.


				Michael I. Bushnell
				Internet: mike@turing.unm.edu
				UUCP: mike@turing.unm.edu
				Bitnet: mike@turing.unm.edu
				CSnet: mike@turing.unm.edu
				YourFavoriteNet: mike@turing.unm.edu
			Golly, don't domains make everything simpler?
For peoply who run UUCP but haven't switched over to smail *yet*, you
can try {ucbvax,gatech}!unmvax!turing!mike.  

Or write:
  {Box 295, Coronado Hall} or {Computer Science, Farris Engineering Center}
  University of New Mexico
  Albuquerque, NM 87131
Or call:
  (505)277- [2992=dorm][6116=work]

I work for the CS department.  But don't blame them.

gwyn@brl-smoke.ARPA (Doug Gwyn ) (02/28/88)

In article <12002@brl-adm.ARPA> roberts@icst-cmr.arpa (John Roberts) writes:
>Are there ANY calculator utilities that will run under Unix (4.3)
>that support FLOATING POINT operations? Maybe even transcendental
>functions? I'm tired of the ones that only work with integers.

Sure; "hoc" is pretty nice.  You can find its source code in
Kernighan & Pike's "The UNIX Programming Environment".

ok@quintus.UUCP (Richard A. O'Keefe) (02/28/88)

In article <12002@brl-adm.ARPA> roberts@icst-cmr.arpa (John Roberts) writes:

>Are there ANY calculator utilities that will run under Unix (4.3)
>that support FLOATING POINT operations? Maybe even transcendental
>functions? I'm tired of the ones that only work with integers.

The calculator I use is hoc6, from the Kernighan & Pike book.
The sources were posted to the net quite some time ago.  hoc6 is
normally interactive, so that you might do
	% hoc6
	x = 1.2
	x^3
		1.728
	^Z
but you can do e.g.
	% echo "1.2^3" | hoc6
	        1.728
so it can replace 'expr' as well as 'bc'.

To be perfectly frank, I'm switching over to xlisp instead.
Not only is it much easier to program, but it's only 2/3 the size...
(Thanks, David Betz!)

You should be able to get xlisp or hoc6 from an archive server.

brad@bradley.UUCP (02/29/88)

What about dc(1)?
Script started on Mon Feb 29 09:04:55 1988
/u5/cardcat/cardcat/other[1](1)% 
/u5/cardcat/cardcat/other[1](1)% 
/u5/cardcat/cardcat/other[1](1)% dc
6k
7.2 22.1 /p
.325791
/u5/cardcat/cardcat/other[2](1)% 
/u5/cardcat/cardcat/other[2](1)% 
script done on Mon Feb 29 09:05:38 1988