bc is an arbitrary precision "calculator", so floats are not
represented in it as in the other "normal" programs.
You should not look at is as a reference.

 In fact you can make any precision calculation you want,
just try (inside bc):

 scale=100
1/3

 This will give you 1/3 with 100 digits!!

 Cheers,

 Xavier

On 5/3/07, Adam Ginsburg <[EMAIL PROTECTED]> wrote:
I have a strange problem that seems not to be isolated to PDL, but
causes problems when using PGPLOT.

I'm making a postscript plot, but when I try to plot certain values
(e.g. -.360000000000001), it makes a bad plot - specifically, it makes
an irrational bounding box (44 -154618798 154619554327).

I've found out that the reason I have such a weird value is that
apparently linux (kernel vers. 2.6.17-11-386) does something weird
with some values.  Example:
9.37-9.73 = -.360000000000001 instead of -.36
1.1-1.2=-0.0999999999999
1.10-1.20 = same
1.10-1.21 = -.11

If I float() the numbers, the precision is worse.  The above values
happen in PDL and OpenOffice, but not in bc (bash calculator), so
presumably this has something to do with the way doubles/floats are
treated in these programs, and bc doesn't use the same method.

Can anyone explain to me why that happens or how to fix it?  Or,
failing that, some workaround to get PGPLOT not to put out bad
bounding boxes?  Is my problem unique?

Thanks,
Adam

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to