On Mon, 29 Jan 2007, Otto Moerbeek wrote:
> On Mon, 29 Jan 2007, Karel Kulhavy wrote:
>
> > I just found three bugs in the OpenBSD 4.0 "bc" program.
>
>
> All three bugs seem to related to the use of a non-decimal input base
> in combination with using the -l lib.
>
> This is because the stored routines interpret the number according to
> the base at execution time.
> Shows what is going on. I have to think a bit on how to solve it and
> what (id) SU says anything about this.
>
> $ bc
> define d(x) {
> return x + 1.1;
> }
> d(0)
> 1.1
> ibase=2
> d(0)
> 1.5
SU does not say anthing explicit about this on first read. In the
meantime I checked Solaris and the original AT&T bc/dc. They both
produce the same results as above. So the behaviour might be
surprising, but it is historically consistent.
Strange is that your 0) test does work OK on Solaris. Some more
investigation to be done...
-Otto