axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] [#197 DFLOAT format] (new)


From: greg
Subject: [Axiom-developer] [#197 DFLOAT format] (new)
Date: Mon, 15 Aug 2005 10:37:08 -0500

Changes http://page.axiom-developer.org/zope/mathaction/197DFLOATFormat/diff
--
Add a format option to DFLOAT.spad. Here is a non documented patch
<pre>
diff -u  /usr/local/axiom/int/algebra/DFLOAT.spad  Axiom/DFLOAT.spad
--- /usr/local/axiom/int/algebra/DFLOAT.spad    2005-08-15 16:48:58.055751184 
+0200
+++ Axiom/DFLOAT.spad   2005-07-24 18:23:33.051285856 +0200
@@ -62,6 +62,7 @@
         ++ Gamma(x) is the Euler Gamma function.
       Beta : (%,%) -> %
         ++ Beta(x,y) is \spad{Gamma(x) * Gamma(y)/Gamma(x+y)}.
+      doubleFloatFormat : String -> String
       rationalApproximation: (%, NonNegativeInteger) -> Fraction Integer
         ++ rationalApproximation(f, n) computes a rational approximation
         ++ r to f with relative error \spad{< 10**(-n)}.
@@ -71,10 +72,17 @@
          ++ (that is, \spad{|(r-f)/f| < b**(-n)}).

  == add
+   format: String := "~G"
    MER ==> Record(MANTISSA:Integer,EXPONENT:Integer)

    manexp: % -> MER

+   doubleFloatFormat(s:String): String ==
+     ss: String := format
+     format := s
+     ss
+
+
    OMwrite(x: %): String ==
      s: String := ""
      sp := OM_-STRINGTOSTRINGPTR(s)$Lisp
@@ -132,7 +140,7 @@
    -- rational approximation to e accurate to 23 digits
    exp1()           == 
FLOAT(534625820200,MOST_-POSITIVE_-LONG_-FLOAT$Lisp)$Lisp / 
FLOAT(196677847971,MOST_-POSITIVE_-LONG_-FLOAT$Lisp)$Lisp
    pi()             == PI$Lisp
-   coerce(x:%):OutputForm == outputForm(x pretend DoubleFloat)
+   coerce(x:%):OutputForm == outputForm(FORMAT(NIL$Lisp,format,x)$Lisp pretend 
DoubleFloat)
    convert(x:%):InputForm == convert(x pretend DoubleFloat)$InputForm
    x < y            == (x<y)$Lisp
    - x              == (-x)$Lisp
</pre>

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

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