[pure-lang-svn] SF.net SVN: pure-lang:[597] pure/trunk/test
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-08-24 01:30:51
|
Revision: 597
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=597&view=rev
Author: agraef
Date: 2008-08-24 01:31:00 +0000 (Sun, 24 Aug 2008)
Log Message:
-----------
Windows compatibility fixes.
Modified Paths:
--------------
pure/trunk/test/test020.log
pure/trunk/test/test020.pure
pure/trunk/test/test021.log
pure/trunk/test/test021.pure
Modified: pure/trunk/test/test020.log
===================================================================
--- pure/trunk/test/test020.log 2008-08-24 00:11:34 UTC (rev 596)
+++ pure/trunk/test/test020.log 2008-08-24 01:31:00 UTC (rev 597)
@@ -45,6 +45,8 @@
check _/*0:01*/ z/*0:1*/ = z/*0:1*/;
format (f/*0:101*/,x/*0:1101*/,y/*0:11101*/,z/*0:1111*/) = str f/*0:101*/+","+show x/*0:1101*/+","+show y/*0:11101*/+","+show z/*0:1111*/;
format (f/*0:101*/,x/*0:1101*/,z/*0:111*/) = str f/*0:101*/+","+show x/*0:1101*/+","+show z/*0:111*/;
+show x/*0:1*/::double = str x/*0:1*/ if infp x/*0:1*/||nanp x/*0:1*/;
+show x/*0:1*/::double = sprintf double_format 0.0 if x/*0:1*/==0.0;
show x/*0:1*/::double = sprintf double_format x/*0:1*/;
show (x/*0:101*/+:y/*0:11*/) = show x/*0:101*/+"+:"+show y/*0:11*/;
show (x/*0:101*/<:y/*0:11*/) = show x/*0:101*/+"<:"+show y/*0:11*/;
@@ -244,41 +246,43 @@
state 15: #0 #1
}
{
- rule #0: show x::double = sprintf double_format x
- rule #1: show (x+:y) = show x+"+:"+show y
- rule #2: show (x<:y) = show x+"<:"+show y
- rule #3: show x = str x
- state 0: #0 #1 #2 #3
+ rule #0: show x::double = str x if infp x||nanp x
+ rule #1: show x::double = sprintf double_format 0.0 if x==0.0
+ rule #2: show x::double = sprintf double_format x
+ rule #3: show (x+:y) = show x+"+:"+show y
+ rule #4: show (x<:y) = show x+"<:"+show y
+ rule #5: show x = str x
+ state 0: #0 #1 #2 #3 #4 #5
<var> state 1
<var>::double state 2
<app> state 3
- state 1: #3
- state 2: #0 #3
- state 3: #1 #2 #3
+ state 1: #5
+ state 2: #0 #1 #2 #5
+ state 3: #3 #4 #5
<var> state 4
<app> state 6
- state 4: #3
+ state 4: #5
<var> state 5
- state 5: #3
- state 6: #1 #2 #3
+ state 5: #5
+ state 6: #3 #4 #5
<var> state 7
+: state 10
<: state 13
- state 7: #3
+ state 7: #5
<var> state 8
- state 8: #3
+ state 8: #5
<var> state 9
- state 9: #3
- state 10: #1 #3
+ state 9: #5
+ state 10: #3 #5
<var> state 11
- state 11: #1 #3
+ state 11: #3 #5
<var> state 12
- state 12: #1 #3
- state 13: #2 #3
+ state 12: #3 #5
+ state 13: #4 #5
<var> state 14
- state 14: #2 #3
+ state 14: #4 #5
<var> state 15
- state 15: #2 #3
+ state 15: #4 #5
}
{
rule #0: tests = puts "*** UNARY ***"$$void (catmap (\f -> catmap (\x -> [test (f,x)]) x) f)$$puts "*** BINARY ***"$$void (catmap (\f -> catmap (\x -> [test (f,x)]) x2) f2)
@@ -2329,7 +2333,7 @@
(*),-1,1,-1
(*),-1,-1,1
(*),-1,0,0
-(*),-1,0.00,-0.00
+(*),-1,0.00,0.00
(*),-1,1.20,-1.20
(*),-1,-1.20,1.20
(*),-1,1L%3L,(-1L)%3L
@@ -2355,14 +2359,14 @@
(*),0,0,0
(*),0,0.00,0.00
(*),0,1.20,0.00
-(*),0,-1.20,-0.00
+(*),0,-1.20,0.00
(*),0,1L%3L,0L%1L
(*),0,(-1L)%4L,0L%1L
(*),0,1+:2,0+:0
(*),0,-1+:2,0+:0
(*),0,1+:-2,0+:0
-(*),0,-1.20+:4.30,-0.00+:0.00
-(*),0,1.20+:-4.30,0.00+:-0.00
+(*),0,-1.20+:4.30,0.00+:0.00
+(*),0,1.20+:-4.30,0.00+:0.00
(*),0,1L%2L+:1,0L%1L+:0
(*),0,1L%2L+:3L%4L,0L%1L+:0L%1L
(*),0,3<:1,0<:1
@@ -2375,18 +2379,18 @@
(*),0,nan,nan
(*),0,x,__failed__
(*),0.00,1,0.00
-(*),0.00,-1,-0.00
+(*),0.00,-1,0.00
(*),0.00,0,0.00
(*),0.00,0.00,0.00
(*),0.00,1.20,0.00
-(*),0.00,-1.20,-0.00
+(*),0.00,-1.20,0.00
(*),0.00,1L%3L,0.00
-(*),0.00,(-1L)%4L,-0.00
+(*),0.00,(-1L)%4L,0.00
(*),0.00,1+:2,0.00+:0.00
-(*),0.00,-1+:2,-0.00+:0.00
-(*),0.00,1+:-2,0.00+:-0.00
-(*),0.00,-1.20+:4.30,-0.00+:0.00
-(*),0.00,1.20+:-4.30,0.00+:-0.00
+(*),0.00,-1+:2,0.00+:0.00
+(*),0.00,1+:-2,0.00+:0.00
+(*),0.00,-1.20+:4.30,0.00+:0.00
+(*),0.00,1.20+:-4.30,0.00+:0.00
(*),0.00,1L%2L+:1,0.00+:0.00
(*),0.00,1L%2L+:3L%4L,0.00+:0.00
(*),0.00,3<:1,0.00<:1
@@ -2424,8 +2428,8 @@
(*),1.20,x,__failed__
(*),-1.20,1,-1.20
(*),-1.20,-1,1.20
-(*),-1.20,0,-0.00
-(*),-1.20,0.00,-0.00
+(*),-1.20,0,0.00
+(*),-1.20,0.00,0.00
(*),-1.20,1.20,-1.44
(*),-1.20,-1.20,1.44
(*),-1.20,1L%3L,-0.400
@@ -2473,7 +2477,7 @@
(*),(-1L)%4L,1,(-1L)%4L
(*),(-1L)%4L,-1,1L%4L
(*),(-1L)%4L,0,0L%1L
-(*),(-1L)%4L,0.00,-0.00
+(*),(-1L)%4L,0.00,0.00
(*),(-1L)%4L,1.20,-0.300
(*),(-1L)%4L,-1.20,0.300
(*),(-1L)%4L,1L%3L,(-1L)%12L
@@ -2521,7 +2525,7 @@
(*),-1+:2,1,-1+:2
(*),-1+:2,-1,1+:-2
(*),-1+:2,0,0+:0
-(*),-1+:2,0.00,-0.00+:0.00
+(*),-1+:2,0.00,0.00+:0.00
(*),-1+:2,1.20,-1.20+:2.40
(*),-1+:2,-1.20,1.20+:-2.40
(*),-1+:2,1L%3L,(-1L)%3L+:2L%3L
@@ -2545,7 +2549,7 @@
(*),1+:-2,1,1+:-2
(*),1+:-2,-1,-1+:2
(*),1+:-2,0,0+:0
-(*),1+:-2,0.00,0.00+:-0.00
+(*),1+:-2,0.00,0.00+:0.00
(*),1+:-2,1.20,1.20+:-2.40
(*),1+:-2,-1.20,-1.20+:2.40
(*),1+:-2,1L%3L,1L%3L+:(-2L)%3L
@@ -2568,8 +2572,8 @@
(*),1+:-2,x,__failed__
(*),-1.20+:4.30,1,-1.20+:4.30
(*),-1.20+:4.30,-1,1.20+:-4.30
-(*),-1.20+:4.30,0,-0.00+:0.00
-(*),-1.20+:4.30,0.00,-0.00+:0.00
+(*),-1.20+:4.30,0,0.00+:0.00
+(*),-1.20+:4.30,0.00,0.00+:0.00
(*),-1.20+:4.30,1.20,-1.44+:5.16
(*),-1.20+:4.30,-1.20,1.44+:-5.16
(*),-1.20+:4.30,1L%3L,-0.400+:1.43
@@ -2592,8 +2596,8 @@
(*),-1.20+:4.30,x,__failed__
(*),1.20+:-4.30,1,1.20+:-4.30
(*),1.20+:-4.30,-1,-1.20+:4.30
-(*),1.20+:-4.30,0,0.00+:-0.00
-(*),1.20+:-4.30,0.00,0.00+:-0.00
+(*),1.20+:-4.30,0,0.00+:0.00
+(*),1.20+:-4.30,0.00,0.00+:0.00
(*),1.20+:-4.30,1.20,1.44+:-5.16
(*),1.20+:-4.30,-1.20,-1.44+:5.16
(*),1.20+:-4.30,1L%3L,0.400+:-1.43
@@ -2899,7 +2903,7 @@
(/),1,3.10<:2.50,0.323<:-2.50
(/),1,2L%3L<:2,1.50<:-2
(/),1,1L%2L<:3L%4L,2.00<:(-3L)%4L
-(/),1,-inf,-0.00
+(/),1,-inf,0.00
(/),1,nan,nan
(/),1,x,__failed__
(/),-1,1,-1.00
@@ -2927,17 +2931,17 @@
(/),-1,nan,nan
(/),-1,x,__failed__
(/),0,1,0.00
-(/),0,-1,-0.00
+(/),0,-1,0.00
(/),0,0,nan
(/),0,0.00,nan
(/),0,1.20,0.00
-(/),0,-1.20,-0.00
+(/),0,-1.20,0.00
(/),0,1L%3L,0.00
-(/),0,(-1L)%4L,-0.00
+(/),0,(-1L)%4L,0.00
(/),0,1+:2,0.00+:0.00
(/),0,-1+:2,0.00+:0.00
(/),0,1+:-2,0.00+:0.00
-(/),0,-1.20+:4.30,-0.00+:0.00
+(/),0,-1.20+:4.30,0.00+:0.00
(/),0,1.20+:-4.30,0.00+:0.00
(/),0,1L%2L+:1,0.00+:0.00
(/),0,1L%2L+:3L%4L,0.00+:0.00
@@ -2947,21 +2951,21 @@
(/),0,3.10<:2.50,0.00<:-2.50
(/),0,2L%3L<:2,0.00<:-2
(/),0,1L%2L<:3L%4L,0.00<:(-3L)%4L
-(/),0,-inf,-0.00
+(/),0,-inf,0.00
(/),0,nan,nan
(/),0,x,__failed__
(/),0.00,1,0.00
-(/),0.00,-1,-0.00
+(/),0.00,-1,0.00
(/),0.00,0,nan
(/),0.00,0.00,nan
(/),0.00,1.20,0.00
-(/),0.00,-1.20,-0.00
+(/),0.00,-1.20,0.00
(/),0.00,1L%3L,0.00
-(/),0.00,(-1L)%4L,-0.00
+(/),0.00,(-1L)%4L,0.00
(/),0.00,1+:2,0.00+:0.00
-(/),0.00,-1+:2,-0.00+:0.00
+(/),0.00,-1+:2,0.00+:0.00
(/),0.00,1+:-2,0.00+:0.00
-(/),0.00,-1.20+:4.30,-0.00+:0.00
+(/),0.00,-1.20+:4.30,0.00+:0.00
(/),0.00,1.20+:-4.30,0.00+:0.00
(/),0.00,1L%2L+:1,0.00+:0.00
(/),0.00,1L%2L+:3L%4L,0.00+:0.00
@@ -2971,7 +2975,7 @@
(/),0.00,3.10<:2.50,0.00<:-2.50
(/),0.00,2L%3L<:2,0.00<:-2
(/),0.00,1L%2L<:3L%4L,0.00<:(-3L)%4L
-(/),0.00,-inf,-0.00
+(/),0.00,-inf,0.00
(/),0.00,nan,nan
(/),0.00,x,__failed__
(/),1.20,1,1.20
@@ -2995,7 +2999,7 @@
(/),1.20,3.10<:2.50,0.387<:-2.50
(/),1.20,2L%3L<:2,1.80<:-2
(/),1.20,1L%2L<:3L%4L,2.40<:(-3L)%4L
-(/),1.20,-inf,-0.00
+(/),1.20,-inf,0.00
(/),1.20,nan,nan
(/),1.20,x,__failed__
(/),-1.20,1,-1.20
@@ -3043,7 +3047,7 @@
(/),1L%3L,3.10<:2.50,0.108<:-2.50
(/),1L%3L,2L%3L<:2,0.500<:-2
(/),1L%3L,1L%2L<:3L%4L,0.667<:(-3L)%4L
-(/),1L%3L,-inf,-0.00
+(/),1L%3L,-inf,0.00
(/),1L%3L,nan,nan
(/),1L%3L,x,__failed__
(/),(-1L)%4L,1,-0.250
@@ -3091,7 +3095,7 @@
(/),1+:2,3.10<:2.50,0.128+:-0.710
(/),1+:2,2L%3L<:2,2.10+:-2.61
(/),1+:2,1L%2L<:3L%4L,4.19+:1.56
-(/),1+:2,-inf,-0.00+:-0.00
+(/),1+:2,-inf,0.00+:0.00
(/),1+:2,nan,nan+:nan
(/),1+:2,x,__failed__
(/),-1+:2,1,-1.00+:2.00
@@ -3115,7 +3119,7 @@
(/),-1+:2,3.10<:2.50,0.645+:-0.324
(/),-1+:2,2L%3L<:2,3.35+:0.116
(/),-1+:2,1L%2L<:3L%4L,1.26+:4.29
-(/),-1+:2,-inf,0.00+:-0.00
+(/),-1+:2,-inf,0.00+:0.00
(/),-1+:2,nan,nan+:nan
(/),-1+:2,x,__failed__
(/),1+:-2,1,1.00+:-2.00
@@ -3139,7 +3143,7 @@
(/),1+:-2,3.10<:2.50,-0.645+:0.324
(/),1+:-2,2L%3L<:2,-3.35+:-0.116
(/),1+:-2,1L%2L<:3L%4L,-1.26+:-4.29
-(/),1+:-2,-inf,-0.00+:0.00
+(/),1+:-2,-inf,0.00+:0.00
(/),1+:-2,nan,nan+:nan
(/),1+:-2,x,__failed__
(/),-1.20+:4.30,1,-1.20+:4.30
@@ -3163,7 +3167,7 @@
(/),-1.20+:4.30,3.10<:2.50,1.14+:-0.880
(/),-1.20+:4.30,2L%3L<:2,6.61+:-1.05
(/),-1.20+:4.30,1L%2L<:3L%4L,4.11+:7.93
-(/),-1.20+:4.30,-inf,0.00+:-0.00
+(/),-1.20+:4.30,-inf,0.00+:0.00
(/),-1.20+:4.30,nan,nan+:nan
(/),-1.20+:4.30,x,__failed__
(/),1.20+:-4.30,1,1.20+:-4.30
@@ -3187,7 +3191,7 @@
(/),1.20+:-4.30,3.10<:2.50,-1.14+:0.880
(/),1.20+:-4.30,2L%3L<:2,-6.61+:1.05
(/),1.20+:-4.30,1L%2L<:3L%4L,-4.11+:-7.93
-(/),1.20+:-4.30,-inf,-0.00+:0.00
+(/),1.20+:-4.30,-inf,0.00+:0.00
(/),1.20+:-4.30,nan,nan+:nan
(/),1.20+:-4.30,x,__failed__
(/),1L%2L+:1,1,0.500+:1.00
@@ -3211,7 +3215,7 @@
(/),1L%2L+:1,3.10<:2.50,0.0638+:-0.355
(/),1L%2L+:1,2L%3L<:2,1.05+:-1.31
(/),1L%2L+:1,1L%2L<:3L%4L,2.09+:0.782
-(/),1L%2L+:1,-inf,-0.00+:-0.00
+(/),1L%2L+:1,-inf,0.00+:0.00
(/),1L%2L+:1,nan,nan+:nan
(/),1L%2L+:1,x,__failed__
(/),1L%2L+:3L%4L,1,0.500+:0.750
@@ -3235,7 +3239,7 @@
(/),1L%2L+:3L%4L,3.10<:2.50,0.0156+:-0.290
(/),1L%2L+:3L%4L,2L%3L<:2,0.711+:-1.15
(/),1L%2L+:3L%4L,1L%2L<:3L%4L,1.75+:0.416
-(/),1L%2L+:3L%4L,-inf,-0.00+:-0.00
+(/),1L%2L+:3L%4L,-inf,0.00+:0.00
(/),1L%2L+:3L%4L,nan,nan+:nan
(/),1L%2L+:3L%4L,x,__failed__
(/),3<:1,1,3.00<:1
@@ -3259,7 +3263,7 @@
(/),3<:1,3.10<:2.50,0.968<:-1.50
(/),3<:1,2L%3L<:2,4.50<:-1
(/),3<:1,1L%2L<:3L%4L,6.00<:1L%4L
-(/),3<:1,-inf,-0.00<:1
+(/),3<:1,-inf,0.00<:1
(/),3<:1,nan,nan<:1
(/),3<:1,x,__failed__
(/),3<:-2.14,1,3.00<:-2.14
@@ -3283,7 +3287,7 @@
(/),3<:-2.14,3.10<:2.50,0.968<:1.64
(/),3<:-2.14,2L%3L<:2,4.50<:2.14
(/),3<:-2.14,1L%2L<:3L%4L,6.00<:-2.89
-(/),3<:-2.14,-inf,-0.00<:-2.14
+(/),3<:-2.14,-inf,0.00<:-2.14
(/),3<:-2.14,nan,nan<:-2.14
(/),3<:-2.14,x,__failed__
(/),3.00<:-3,1,3.00<:-3
@@ -3307,7 +3311,7 @@
(/),3.00<:-3,3.10<:2.50,0.968<:0.783
(/),3.00<:-3,2L%3L<:2,4.50<:1.28
(/),3.00<:-3,1L%2L<:3L%4L,6.00<:2.53
-(/),3.00<:-3,-inf,-0.00<:-3
+(/),3.00<:-3,-inf,0.00<:-3
(/),3.00<:-3,nan,nan<:-3
(/),3.00<:-3,x,__failed__
(/),3.10<:2.50,1,3.10<:2.50
@@ -3331,7 +3335,7 @@
(/),3.10<:2.50,3.10<:2.50,1.00<:0.00
(/),3.10<:2.50,2L%3L<:2,4.65<:0.500
(/),3.10<:2.50,1L%2L<:3L%4L,6.20<:1.75
-(/),3.10<:2.50,-inf,-0.00<:2.50
+(/),3.10<:2.50,-inf,0.00<:2.50
(/),3.10<:2.50,nan,nan<:2.50
(/),3.10<:2.50,x,__failed__
(/),2L%3L<:2,1,0.667<:2
@@ -3355,7 +3359,7 @@
(/),2L%3L<:2,3.10<:2.50,0.215<:-0.500
(/),2L%3L<:2,2L%3L<:2,1.00<:0
(/),2L%3L<:2,1L%2L<:3L%4L,1.33<:5L%4L
-(/),2L%3L<:2,-inf,-0.00<:2
+(/),2L%3L<:2,-inf,0.00<:2
(/),2L%3L<:2,nan,nan<:2
(/),2L%3L<:2,x,__failed__
(/),1L%2L<:3L%4L,1,0.500<:3L%4L
@@ -3379,7 +3383,7 @@
(/),1L%2L<:3L%4L,3.10<:2.50,0.161<:-1.75
(/),1L%2L<:3L%4L,2L%3L<:2,0.750<:(-5L)%4L
(/),1L%2L<:3L%4L,1L%2L<:3L%4L,1.00<:0L%1L
-(/),1L%2L<:3L%4L,-inf,-0.00<:3L%4L
+(/),1L%2L<:3L%4L,-inf,0.00<:3L%4L
(/),1L%2L<:3L%4L,nan,nan<:3L%4L
(/),1L%2L<:3L%4L,x,__failed__
(/),-inf,1,-inf
@@ -3470,8 +3474,8 @@
(^),1,1L%2L+:1,1.00+:0.00
(^),1,1L%2L+:3L%4L,1.00+:0.00
(^),1,3<:1,1.00<:0.00
-(^),1,3<:-2.14,1.00<:-0.00
-(^),1,3.00<:-3,1.00<:-0.00
+(^),1,3<:-2.14,1.00<:0.00
+(^),1,3.00<:-3,1.00<:0.00
(^),1,3.10<:2.50,1.00<:0.00
(^),1,2L%3L<:2,1.00<:0.00
(^),1,1L%2L<:3L%4L,1.00<:0.00
@@ -3696,8 +3700,8 @@
(^),-1+:2,x,__failed__
(^),1+:-2,1,1.00+:-2.00
(^),1+:-2,-1,0.200+:0.400
-(^),1+:-2,0,1.00+:-0.00
-(^),1+:-2,0.00,1.00+:-0.00
+(^),1+:-2,0,1.00+:0.00
+(^),1+:-2,0.00,1.00+:0.00
(^),1+:-2,1.20,0.630+:-2.55
(^),1+:-2,-1.20,0.0913+:0.370
(^),1+:-2,1L%3L,1.22+:-0.472
@@ -3744,8 +3748,8 @@
(^),-1.20+:4.30,x,__failed__
(^),1.20+:-4.30,1,1.20+:-4.30
(^),1.20+:-4.30,-1,0.0602+:0.216
-(^),1.20+:-4.30,0,1.00+:-0.00
-(^),1.20+:-4.30,0.00,1.00+:-0.00
+(^),1.20+:-4.30,0,1.00+:0.00
+(^),1.20+:-4.30,0.00,1.00+:0.00
(^),1.20+:-4.30,1.20,0.0748+:-6.02
(^),1.20+:-4.30,-1.20,0.00206+:0.166
(^),1.20+:-4.30,1L%3L,1.49+:-0.691
@@ -3840,8 +3844,8 @@
(^),3<:1,x,__failed__
(^),3<:-2.14,1,3.00<:-2.14
(^),3<:-2.14,-1,0.333<:2.14
-(^),3<:-2.14,0,1.00<:-0.00
-(^),3<:-2.14,0.00,1.00<:-0.00
+(^),3<:-2.14,0,1.00<:0.00
+(^),3<:-2.14,0.00,1.00<:0.00
(^),3<:-2.14,1.20,3.74<:-2.57
(^),3<:-2.14,-1.20,0.268<:2.57
(^),3<:-2.14,1L%3L,1.44<:-0.714
@@ -3864,8 +3868,8 @@
(^),3<:-2.14,x,__failed__
(^),3.00<:-3,1,3.00<:-3.00
(^),3.00<:-3,-1,0.333<:3.00
-(^),3.00<:-3,0,1.00<:-0.00
-(^),3.00<:-3,0.00,1.00<:-0.00
+(^),3.00<:-3,0,1.00<:0.00
+(^),3.00<:-3,0.00,1.00<:0.00
(^),3.00<:-3,1.20,3.74<:2.68
(^),3.00<:-3,-1.20,0.268<:-2.68
(^),3.00<:-3,1L%3L,1.44<:-1.00
@@ -3959,7 +3963,7 @@
(^),1L%2L<:3L%4L,nan,nan<:nan
(^),1L%2L<:3L%4L,x,__failed__
(^),-inf,1,-inf
-(^),-inf,-1,-0.00
+(^),-inf,-1,0.00
(^),-inf,0,1.00
(^),-inf,0.00,1.00
(^),-inf,1.20,inf
Modified: pure/trunk/test/test020.pure
===================================================================
--- pure/trunk/test/test020.pure 2008-08-24 00:11:34 UTC (rev 596)
+++ pure/trunk/test/test020.pure 2008-08-24 01:31:00 UTC (rev 597)
@@ -42,7 +42,11 @@
format (f,x,y,z) = str f+","+show x+","+show y+","+show z;
format (f,x,z) = str f+","+show x+","+show z;
-show x::double = sprintf double_format x;
+show x::double
+= str x if infp x || nanp x; // fix Windoze quirks
+= sprintf double_format 0.0 if x==0.0; // work around +/-0.0 issues
+= sprintf double_format x otherwise;
+
show (x+:y) = show x+"+:"+show y;
show (x<:y) = show x+"<:"+show y;
show x = str x otherwise;
Modified: pure/trunk/test/test021.log
===================================================================
--- pure/trunk/test/test021.log 2008-08-24 00:11:34 UTC (rev 596)
+++ pure/trunk/test/test021.log 2008-08-24 01:31:00 UTC (rev 597)
@@ -7,6 +7,8 @@
check _/*0:01*/ z/*0:1*/ = z/*0:1*/;
format (f/*0:101*/,x/*0:1101*/,y/*0:11101*/,z/*0:1111*/) = str f/*0:101*/+","+show x/*0:1101*/+","+show y/*0:11101*/+","+show z/*0:1111*/;
format (f/*0:101*/,x/*0:1101*/,z/*0:111*/) = str f/*0:101*/+","+show x/*0:1101*/+","+show z/*0:111*/;
+show x/*0:1*/::double = str x/*0:1*/ if infp x/*0:1*/||nanp x/*0:1*/;
+show x/*0:1*/::double = sprintf double_format 0.0 if x/*0:1*/==0.0;
show x/*0:1*/::double = sprintf double_format x/*0:1*/;
show (x/*0:101*/+:y/*0:11*/) = show x/*0:101*/+"+:"+show y/*0:11*/;
show (x/*0:101*/<:y/*0:11*/) = show x/*0:101*/+"<:"+show y/*0:11*/;
@@ -226,41 +228,43 @@
state 15: #0 #1
}
{
- rule #0: show x::double = sprintf double_format x
- rule #1: show (x+:y) = show x+"+:"+show y
- rule #2: show (x<:y) = show x+"<:"+show y
- rule #3: show x = str x
- state 0: #0 #1 #2 #3
+ rule #0: show x::double = str x if infp x||nanp x
+ rule #1: show x::double = sprintf double_format 0.0 if x==0.0
+ rule #2: show x::double = sprintf double_format x
+ rule #3: show (x+:y) = show x+"+:"+show y
+ rule #4: show (x<:y) = show x+"<:"+show y
+ rule #5: show x = str x
+ state 0: #0 #1 #2 #3 #4 #5
<var> state 1
<var>::double state 2
<app> state 3
- state 1: #3
- state 2: #0 #3
- state 3: #1 #2 #3
+ state 1: #5
+ state 2: #0 #1 #2 #5
+ state 3: #3 #4 #5
<var> state 4
<app> state 6
- state 4: #3
+ state 4: #5
<var> state 5
- state 5: #3
- state 6: #1 #2 #3
+ state 5: #5
+ state 6: #3 #4 #5
<var> state 7
+: state 10
<: state 13
- state 7: #3
+ state 7: #5
<var> state 8
- state 8: #3
+ state 8: #5
<var> state 9
- state 9: #3
- state 10: #1 #3
+ state 9: #5
+ state 10: #3 #5
<var> state 11
- state 11: #1 #3
+ state 11: #3 #5
<var> state 12
- state 12: #1 #3
- state 13: #2 #3
+ state 12: #3 #5
+ state 13: #4 #5
<var> state 14
- state 14: #2 #3
+ state 14: #4 #5
<var> state 15
- state 15: #2 #3
+ state 15: #4 #5
}
{
rule #0: tests = puts "*** EXACT/INEXACT ***"$$do test (catmap (\op -> catmap (\a -> [(op,2,a)]) [2+:3,2<:3,2%3]) [(+),(-),(*),(%),(/),(^)])$$do test (catmap (\op -> catmap (\a -> [(op,a,2)]) [2+:3,2<:3,2%3]) [(+),(-),(*),(%),(/),(^)])$$puts "*** SYMBOLIC ***"$$do test (catmap (\op -> catmap (\a -> [(op,x,a)]) [2+:3,2<:3,2%3]) [(+),(-),(*),(%),(/),(^)])$$do test (catmap (\op -> catmap (\a -> [(op,a,x)]) [2+:3,2<:3,2%3]) [(+),(-),(*),(%),(/),(^)])
Modified: pure/trunk/test/test021.pure
===================================================================
--- pure/trunk/test/test021.pure 2008-08-24 00:11:34 UTC (rev 596)
+++ pure/trunk/test/test021.pure 2008-08-24 01:31:00 UTC (rev 597)
@@ -21,7 +21,11 @@
format (f,x,y,z) = str f+","+show x+","+show y+","+show z;
format (f,x,z) = str f+","+show x+","+show z;
-show x::double = sprintf double_format x;
+show x::double
+= str x if infp x || nanp x; // fix Windoze quirks
+= sprintf double_format 0.0 if x==0.0; // work around +/-0.0 issues
+= sprintf double_format x otherwise;
+
show (x+:y) = show x+"+:"+show y;
show (x<:y) = show x+"<:"+show y;
show x = str x otherwise;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|