axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] [Richard Fateman <address@hidden>] Re: [Maxima] st


From: Bill Page
Subject: Re: [Axiom-developer] [Richard Fateman <address@hidden>] Re: [Maxima] strange behaviour with simple decimals / Axiom
Date: Wed, 11 Apr 2007 22:30:04 -0400
User-agent: Webmail 4.0

Quoting Gabriel Dos Reis <address@hidden>:

... Bill Page wrote:
| (%i2) 1.96 - 1.4^2;
| (%o2)                       2.2204460492503131E-16
| (%i3)

I believe that can explained by the fact that Axiom uses the host
"long double" C datatype for DoubleFloat whereas Maxima must be
using the more conventional and reliable "double" C datatype.

No. By default Axiom uses it's own adjustable precision floating
point. See domain Float and the 'precision()' function.
If you want DoubleFloat you would write:

(1) -> A:=1.4::DoubleFloat

   (1)  1.3999999999999999
                                      Type: DoubleFloat

(2) -> A^2

   (2)  1.9599999999999997
                                      Type: DoubleFloat

(3) -> B:=1.9599999999999997::DoubleFloat

   (3)  1.9599999999999997
                                      Type: DoubleFloat

(4) -> B-A^2

   (4)  0.0
                                      Type: DoubleFloat

Of the "machine" float:

(5) -> A:=1.4::MachineFloat

   (5)  1.4
                                      Type: MachineFloat

(6) -> A^2

   (6)  1.96
                                      Type: MachineFloat

(7) -> B:=1.96::MachineFloat

   (7)  1.96
                                      Type: MachineFloat

(8) -> B-A^2

   (8)  0.2220446049 250313 E -15
                                      Type: MachineFloat

... | In Axiom version of 1/17/2005
|
| 1.4^2  comes out as 1.96
|
| 1.96 - 1.4^2  comes out as  0.7 E -20
|





reply via email to

[Prev in Thread] Current Thread [Next in Thread]