[clean-list] questions from a beginner

lethevert acatofearlgrey at ybb.ne.jp
Sun Apr 29 17:23:39 MEST 2007


Hello,

 >> *My first solution try:
 >>    smallestRealv2 = until (\x = x/10.0 == 0.0 ) (\x = x/10.0) 1.0
 >>    Start = smallestRealv2
 >> It prints: 0

 > This one I'm not sure about. Your solution seems correct, and when I try
 > your solution in Haskell I do get the last number in that list. Not sure
 > what's happening here.
 >

I found a strange behaviour of a related clean program.
I wrote a test code below.

=======================================================
Start = let n1 = 9.88131291682493E-324 / 10.0
             n2 = 9.88131291682493E-324 / 10.0
         in (n1 <> 0.0, n2 <> 0.0, n2)
=======================================================

Apparently the variable n1 and n2 have exactly the same value,
but it produces: (True, False, 0)

I checked the intermediate abc code and find that
the code for n1 is
=======================================================
	pushR 10.0
	pushR 9.88131291682493E-324
	divR
	pushR 0.0
         ...
	eqR
	notB
=======================================================
and then I changed it to
=======================================================
	pushR 10.0
	pushR 9.88131291682493E-324
	divR
	buildR_b 0
	pop_b 2
	pushR_a 0
	pop_a 1
	pushR 0.0
         ...
	eqR
	notB
=======================================================
and I got: (False, False, 0)

It seams that the A-stack has some effect on a Real number value,
but I have no further idea about it.

I uses Clean 2.2 for Linux 32bit version.


-- 
lethevert
lethevert at users.sourceforge.net


More information about the clean-list mailing list