[TUHS] interesting case of not getting the point: dc on a mac

Dan Cross crossd at gmail.com
Mon Jan 23 23:43:00 AEST 2023


On Sun, Jan 22, 2023 at 10:11 PM Larry McVoy <lm at mcvoy.com> wrote:
> On Mon, Jan 23, 2023 at 02:07:14PM +1100, Dave Horsfall wrote:
> > On Sun, 22 Jan 2023, Steve Nickolas wrote:
> >
> > > I think there was one particular dc clone...guy whose name started with
> > > a G? and his version did that.
> >
> > On my ancient MacBook Pro (13-inch, mid 2010, High Sierra 10.13.6):
> >
> >     mackie:~ dave$ dc
> >     (^D)
> >     mackie:~ dave$ dc -V
> >     dc (GNU bc 1.06) 1.3
> >
> > On my ancient FreeBSD server:
> >
> >     aneurin% dc
> >     (^D)
> >     aneurin% dc -V
> >     dc (BSD bc) 1.3-FreeBSD
> >
> > Nil prompt in both cases.
> >
> > > Most Linux versions use GNU's which Does The Right Thing???????.
>
> I know this is about dc (which I think is under bc or is it the other way
> around?)

The other way around. `bc` is a little interpreter that accepts infix
notation and has a fairly complete language built into it that
generates `dc` and delegates to that to do the actual mathematics.

> but to pick on GNU:
>
> slovax ~ 'bc'
> bc 1.06.95
> Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
> This is free software with ABSOLUTELY NO WARRANTY.
> For details type `warranty'.
> slovax ~ alias bc
> alias bc='bc -ql'
>
> because, well, the same reason I run vi in terse mode.

Agreed. The copyright banner every time I run `bc` is excruciating.

The `-l` argument came up not too long ago elsewhere; someone asked
why `bc -l` is not the default. For those that don't know, `bc -l`
loads a library of math functions (sine/cosine, arctan, and a couple
of transcendentals) and sets the scale to 20 decimal points. It's very
useful, but I suspect the reason this wasn't the default is that
loading that library cost RAM and real cycles on a PDP-11 and for most
simple uses that wasn't necessary.

        - Dan C.


More information about the TUHS mailing list