axiom-developer
[Top][All Lists]
Advanced

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

[Axiom-developer] 20090305.01.tpd.patch (bookvol10.3 add Grabmeier/Hebis


From: daly
Subject: [Axiom-developer] 20090305.01.tpd.patch (bookvol10.3 add Grabmeier/Hebisch Float fix)
Date: Fri, 6 Mar 2009 05:33:26 -0600

Johannes Grabmeier pointed out failures in Float output when
manipulating the outputFixed parameter and posted fixes.  Waldek
Hebisch rewrote and added to the fix. Both have been added to
bookvol10.3 Axiom Domains / Float / fixed function has been modified
with these fixes.

=======================================================================
diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet
index 2972ab5..014f47c 100644
--- a/books/bookvol10.3.pamphlet
+++ b/books/bookvol10.3.pamphlet
@@ -32211,13 +32211,12 @@ It is currently unknown whether the unexpected 
behaviour
 of shift for negative arguments will cause bugs in other
 parts of Axiom.
 <<Float.input>>=
--- float.spad.pamphlet Float.input
 )sys rm -f Float.output
 )spool Float.output
 )set message test on
 )set message auto off
 )clear all
---S 1 of 37
+--S 1 of 64
 1.234
 --R 
 --R
@@ -32225,7 +32224,7 @@ parts of Axiom.
 --R                                                                  Type: 
Float
 --E 1
 
---S 2 of 37
+--S 2 of 64
 1.234E2
 --R 
 --R
@@ -32233,7 +32232,7 @@ parts of Axiom.
 --R                                                                  Type: 
Float
 --E 2
 
---S 3 of 37
+--S 3 of 64
 sqrt(1.2 + 2.3 / 3.4 ** 4.5)
 --R 
 --R
@@ -32241,7 +32240,7 @@ sqrt(1.2 + 2.3 / 3.4 ** 4.5)
 --R                                                                  Type: 
Float
 --E 3
 
---S 4 of 37
+--S 4 of 64
 i := 3 :: Float
 --R 
 --R
@@ -32249,7 +32248,7 @@ i := 3 :: Float
 --R                                                                  Type: 
Float
 --E 4
 
---S 5 of 37
+--S 5 of 64
 i :: Integer
 --R 
 --R
@@ -32257,7 +32256,7 @@ i :: Integer
 --R                                                                Type: 
Integer
 --E 5
 
---S 6 of 37
+--S 6 of 64
 i :: Fraction Integer 
 --R 
 --R
@@ -32265,7 +32264,7 @@ i :: Fraction Integer
 --R                                                       Type: Fraction 
Integer
 --E 6
 
---S 7 of 37
+--S 7 of 64
 r := 3/7 :: Float 
 --R 
 --R
@@ -32273,7 +32272,7 @@ r := 3/7 :: Float
 --R                                                                  Type: 
Float
 --E 7
 
---S 8 of 37
+--S 8 of 64
 r :: Fraction Integer
 --R 
 --R
@@ -32283,7 +32282,7 @@ r :: Fraction Integer
 --R                                                       Type: Fraction 
Integer
 --E 8
 
---S 9 of 37
+--S 9 of 64
 r :: Integer
 --R 
 --R 
@@ -32293,7 +32292,7 @@ r :: Integer
 --R
 --E 9
 
---S 10 of 37
+--S 10 of 64
 truncate 3.6
 --R 
 --R
@@ -32301,7 +32300,7 @@ truncate 3.6
 --R                                                                  Type: 
Float
 --E 10
 
---S 11 of 37
+--S 11 of 64
 round 3.6
 --R 
 --R
@@ -32309,7 +32308,7 @@ round 3.6
 --R                                                                  Type: 
Float
 --E 11
 
---S 12 of 37
+--S 12 of 64
 truncate(-3.6)
 --R 
 --R
@@ -32317,7 +32316,7 @@ truncate(-3.6)
 --R                                                                  Type: 
Float
 --E 12
 
---S 13 of 37
+--S 13 of 64
 round(-3.6)
 --R 
 --R
@@ -32325,7 +32324,7 @@ round(-3.6)
 --R                                                                  Type: 
Float
 --E 13
 
---S 14 of 37
+--S 14 of 64
 fractionPart 3.6
 --R 
 --R
@@ -32333,7 +32332,7 @@ fractionPart 3.6
 --R                                                                  Type: 
Float
 --E 14
 
---S 15 of 37
+--S 15 of 64
 digits 40 
 --R 
 --R
@@ -32341,7 +32340,7 @@ digits 40
 --R                                                        Type: 
PositiveInteger
 --E 15
 
---S 16 of 37
+--S 16 of 64
 sqrt 0.2
 --R 
 --R
@@ -32349,7 +32348,7 @@ sqrt 0.2
 --R                                                                  Type: 
Float
 --E 16
 
---S 17 of 37
+--S 17 of 64
 pi()$Float
 --R 
 --R
@@ -32357,7 +32356,7 @@ pi()$Float
 --R                                                                  Type: 
Float
 --E 17
 
---S 18 of 37
+--S 18 of 64
 digits 500
 --R 
 --R
@@ -32365,7 +32364,7 @@ digits 500
 --R                                                        Type: 
PositiveInteger
 --E 18
 
---S 19 of 37
+--S 19 of 64
 pi()$Float
 --R 
 --R
@@ -32381,7 +32380,7 @@ pi()$Float
 --R                                                                  Type: 
Float
 --E 19
 
---S 20 of 37
+--S 20 of 64
 digits 20
 --R 
 --R
@@ -32389,7 +32388,7 @@ digits 20
 --R                                                        Type: 
PositiveInteger
 --E 20
 
---S 21 of 37
+--S 21 of 64
 outputSpacing 0; x := sqrt 0.2
 --R 
 --R
@@ -32397,7 +32396,7 @@ outputSpacing 0; x := sqrt 0.2
 --R                                                                  Type: 
Float
 --E 21
 
---S 22 of 37
+--S 22 of 64
 outputSpacing 5; x
 --R 
 --R
@@ -32405,7 +32404,7 @@ outputSpacing 5; x
 --R                                                                  Type: 
Float
 --E 22
 
---S 23 of 37
+--S 23 of 64
 y := x/10**10
 --R 
 --R
@@ -32413,7 +32412,7 @@ y := x/10**10
 --R                                                                  Type: 
Float
 --E 23
 
---S 24 of 37
+--S 24 of 64
 outputFloating(); x 
 --R 
 --R
@@ -32421,7 +32420,7 @@ outputFloating(); x
 --R                                                                  Type: 
Float
 --E 24
 
---S 25 of 37
+--S 25 of 64
 outputFixed(); y 
 --R 
 --R
@@ -32429,7 +32428,7 @@ outputFixed(); y
 --R                                                                  Type: 
Float
 --E 25
 
---S 26 of 37
+--S 26 of 64
 outputFloating 2; y 
 --R 
 --R
@@ -32437,7 +32436,7 @@ outputFloating 2; y
 --R                                                                  Type: 
Float
 --E 26
 
---S 27 of 37
+--S 27 of 64
 outputFixed 2; x 
 --R 
 --R
@@ -32445,13 +32444,13 @@ outputFixed 2; x
 --R                                                                  Type: 
Float
 --E 27
 
---S 28 of 37
+--S 28 of 64
 outputGeneral()
 --R 
 --R                                                                   Type: 
Void
 --E 28
 
---S 29 of 37
+--S 29 of 64
 a: Matrix Fraction Integer := matrix [ [1/(i+j+1) for j in 0..9] for i in 0..9]
 --R 
 --R
@@ -32497,7 +32496,7 @@ a: Matrix Fraction Integer := matrix [ [1/(i+j+1) for j 
in 0..9] for i in 0..9]
 --R                                                Type: Matrix Fraction 
Integer
 --E 29
 
---S 30 of 37
+--S 30 of 64
 d:= determinant a
 --R 
 --R
@@ -32507,7 +32506,7 @@ d:= determinant a
 --R                                                       Type: Fraction 
Integer
 --E 30
 
---S 31 of 37
+--S 31 of 64
 d :: Float
 --R 
 --R
@@ -32515,7 +32514,7 @@ d :: Float
 --R                                                                  Type: 
Float
 --E 31
 
---S 32 of 37
+--S 32 of 64
 b: Matrix DoubleFloat := matrix [ [1/(i+j+1$DoubleFloat) for j in 0..9] for i 
in 0..9]
 --R 
 --R
@@ -32575,7 +32574,7 @@ b: Matrix DoubleFloat := matrix [ 
[1/(i+j+1$DoubleFloat) for j in 0..9] for i in
 --R                                                     Type: Matrix 
DoubleFloat
 --E 32
 
---S 33 of 37
+--S 33 of 64
 determinant b
 --R 
 --R
@@ -32583,7 +32582,7 @@ determinant b
 --R                                                            Type: 
DoubleFloat
 --E 33
 
---S 34 of 37
+--S 34 of 64
 digits 40 
 --R 
 --R
@@ -32591,7 +32590,7 @@ digits 40
 --R                                                        Type: 
PositiveInteger
 --E 34
 
---S 35 of 37
+--S 35 of 64
 c: Matrix Float := matrix [ [1/(i+j+1$Float) for j in 0..9] for i in 0..9]
 --R 
 --R
@@ -32685,7 +32684,7 @@ c: Matrix Float := matrix [ [1/(i+j+1$Float) for j in 
0..9] for i in 0..9]
 --R                                                           Type: Matrix 
Float
 --E 35
 
---S 36 of 37
+--S 36 of 64
 determinant c
 --R 
 --R
@@ -32693,13 +32692,208 @@ determinant c
 --R                                                                  Type: 
Float
 --E 36
 
---S 37 of 37
+--S 37 of 64
 digits 20
 --R 
 --R
 --R   (36)  40
 --R                                                        Type: 
PositiveInteger
 --E 37
+
+)clear all
+
+--S 38 of 64
+outputFixed()
+--R 
+--R                                                                   Type: 
Void
+--E 38
+
+--S 39 of 64
+a:=3.0
+--R 
+--R
+--R   (2)  3.0
+--R                                                                  Type: 
Float
+--E 39
+
+--S 40 of 64
+b:=3.1
+--R 
+--R
+--R   (3)  3.1
+--R                                                                  Type: 
Float
+--E 40
+
+--S 41 of 64
+c:=numeric pi()
+--R 
+--R
+--R   (4)  3.14159 26535 89793 2385
+--R                                                                  Type: 
Float
+--E 41
+
+--S 42 of 64
+d:=0.0
+--R 
+--R
+--R   (5)  0.0
+--R                                                                  Type: 
Float
+--E 42
+
+--S 43 of 64
+outputFixed 2
+--R 
+--R                                                                   Type: 
Void
+--E 43
+
+--S 44 of 64
+a
+--R 
+--R
+--R   (7)  3.00
+--R                                                                  Type: 
Float
+--E 44
+
+--S 45 of 64
+b
+--R 
+--R
+--R   (8)  3.10
+--R                                                                  Type: 
Float
+--E 45
+
+--S 46 of 64
+c
+--R 
+--R
+--R   (9)  3.14
+--R                                                                  Type: 
Float
+--E 46
+
+--S 47 of 64
+d
+--R 
+--R
+--R   (10)  0.00
+--R                                                                  Type: 
Float
+--E 47
+
+--S 48 of 64
+outputFixed 0
+--R 
+--R                                                                   Type: 
Void
+--E 48
+
+--S 49 of 64
+a
+--R 
+--R
+--R   (12)  3.0
+--R                                                                  Type: 
Float
+--E 49
+
+--S 50 of 64
+b
+--R 
+--R
+--R   (13)  3.
+--R                                                                  Type: 
Float
+--E 50
+
+--S 51 of 64
+c
+--R 
+--R
+--R   (14)  3.
+--R                                                                  Type: 
Float
+--E 51
+
+--S 52 of 64
+31.1
+--R 
+--R
+--R   (15)  31.
+--R                                                                  Type: 
Float
+--E 52
+
+--S 53 of 64
+310.1
+--R 
+--R
+--R   (16)  310.
+--R                                                                  Type: 
Float
+--E 53
+
+--S 54 of 64
+d
+--R 
+--R
+--R   (17)  0.0
+--R                                                                  Type: 
Float
+--E 54
+
+--S 55 of 64
+outputFixed(0)
+--R                                                                   Type: 
Void
+--E 55
+
+--S 56 of 64
+1.1
+--R
+--R   (19)  1.
+--R                                                                  Type: 
Float
+--E 56
+
+--S 57 of 64
+3111.1
+--R
+--R   (20)  3111.
+--R                                                                  Type: 
Float
+--E 57
+
+--S 58 of 64
+1234567890.1
+--R
+--R   (21)  12345 67890.
+--R                                                                  Type: 
Float
+--E 58
+
+--S 59 of 64
+outputFixed(12)
+--R                                                                   Type: 
Void
+--E 59
+
+--S 60 of 64
+1234567890.1
+--R
+--R   (23)  12345 67890.09999 99999 99
+--R                                                                  Type: 
Float
+--E 60
+
+--S 61 of 64
+outputFixed(15)
+--R                                                                   Type: 
Void
+--E 61
+
+--S 62 of 64
+1234567890.1
+--R
+--R   (25)  12345 67890.09999 99999 98545
+--R                                                                  Type: 
Float
+--E 62
+
+--S 63 of 64
+outputFixed(2)
+--R                                                                   Type: 
Void
+--E 63
+
+--S 64 of 64
+1234567890.1
+--R
+--R   (27)  12345 67890.10
+--R                                                                  Type: 
Float
+--E 64
+
 )spool
 )lisp (bye)
 @
@@ -33975,13 +34169,23 @@ Float():
       t
 
    fixed f ==
-      zero? f => "0.0"
+      d := if OUTPREC() = -1 then digits::I else OUTPREC()
+      dpos:N:= if (d > 0) then d::N else 1::N
+      zero? f =>
+        OUTPREC() = -1 => "0.0"
+        concat("0",concat(".",padFromLeft new(dpos,zero)))
       zero? exponent f =>
-        padFromRight concat(convert(mantissa f)@S, ".0")
+        concat(padFromRight convert(mantissa f)@S,
+               concat(".",padFromLeft new(dpos,zero)))
       negative? f => concat("-", fixed abs f)
-      d := if OUTPREC() = -1 then digits::I else OUTPREC()
---    g := convert10(abs f,digits); m := g.mantissa; e := g.exponent
-      g := convert10(abs f,d); m := g.mantissa; e := g.exponent
+      bl := LENGTH(f.mantissa) + f.exponent
+      dd :=
+        OUTPREC() = -1 => d
+        bl > 0 => (146*bl) quo 485 + 1 + d
+        d
+      g := convert10(abs f,dd)
+      m := g.mantissa
+      e := g.exponent
       if OUTPREC() ^= -1 then
          -- round g to OUTPREC digits after the decimal point
          l := length10 m
diff --git a/changelog b/changelog
index eda3d93..9d2a7f5 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,8 @@
+20090305 tpd src/axiom-website/patches.html 20090305.01.tpd.patch
+20090305 jxb books/bookvol10.3 fix Float outputFixed handling
+20090305 jxb Johannes Grabmeier <address@hidden>
+20090305 tpd src/input/ndftip.input fix count mismatch
+20090305 tpd src/input/test.input fix count mismatch
 20090304 tpd src/axiom-website/patches.html 20090304.01.tpd.patch
 20090304 tpd books/bookvol10.4 fix typo
 20090304 tpd books/bookvol5 add user level command roots
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index 18722ce..b2dbc9c 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -987,5 +987,7 @@ bookvol10.4 add API ApplicationProgramInterface<br/>
 bookvol10.4 add Nag documentation<br/>
 <a href="patches/20090304.01.tpd.patch">20090304.01.tpd.patch</a>
 bookvol5 add user level command roots<br/>
+<a href="patches/20090305.01.tpd.patch">20090305.01.tpd.patch</a>
+bookvol10.3 add Grabmeier/Waldek fixes to Float<br/>
  </body>
 </html>
diff --git a/src/input/ndftip.input.pamphlet b/src/input/ndftip.input.pamphlet
index 3e4c0ab..11945fc 100644
--- a/src/input/ndftip.input.pamphlet
+++ b/src/input/ndftip.input.pamphlet
@@ -586,7 +586,7 @@ hdftsD := nagHermitianDFT seqsD;
 --S 34 of 45 used to work?
 map(expand,hdftsD) :: List Vector Complex Float
 --R 
---R   There are 68 exposed and 9 unexposed library operations named map 
+--R   There are 74 exposed and 8 unexposed library operations named map 
 --R      having 2 argument(s) but none was determined to be applicable. 
 --R      Use HyperDoc Browse, or issue
 --R                               )display op map
diff --git a/src/input/test.input.pamphlet b/src/input/test.input.pamphlet
index 09163a6..e4f29ea 100644
--- a/src/input/test.input.pamphlet
+++ b/src/input/test.input.pamphlet
@@ -846,7 +846,7 @@ m = [[1,2],[2,3]]  -- Should return type EQ POLY 
SQMATRIX(2, INT)
 --S 65 of 188
 1/"asd"
 --R 
---R   There are 13 exposed and 12 unexposed library operations named / 
+--R   There are 14 exposed and 12 unexposed library operations named / 
 --R      having 2 argument(s) but none was determined to be applicable. 
 --R      Use HyperDoc Browse, or issue
 --R                                )display op /





reply via email to

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