PilCon tomorrow

2021-12-19 Thread Alexander Burger
Hi all,

please note that tomorrow, 16:00 UTC, is PilCon again:

   https://meeting.itship.ch/PilCon

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Fixpoint Numbers strange problem

2021-12-19 Thread Jimmie Houchin
I am exploring PicoLisp again after several years. The idea of PicoLisp 
is so very appealing. It is getting my reality to fit in its idea.


I have revisited my original problem from this thread.

https://www.mail-archive.com/picolisp@software-lab.de/msg07561.html


At that time I still could not get the PicoLisp version to numbers to be 
equivalent with all other platforms I tested.


..

(de loop1calc (I J N)
   (let V (*/ N (+ I N) (- J N) 0.1234567 `(* 1.0 1.0 1.0))
  (normalize (*/ V V V `(* 1.0 1.0)) ) ) )

(de loop2calc (I J N)
   (normalize
  (*/ N
 (+ J 1.0)
 (+ N N N)
 0.1234567
 `(* 1.0 1.0 1.0) ) ) )

..


When I reverse the names of these functions. What is normally loop2calc 
produces the same results as the other implementations. So it is what is 
the loop1calc function that is bringing the difference.


So I began to add print statements to the loop to discover the values.

(if (= I 1.0) ... )


I have (scl 17) in my current file.

I wanted to see what was at the end of the looping and I did (if (= I 
100.0) ... ) to get the last loop and printed nothing. However when I 
did (if (> I 99.0) ... ) it printed some values for loop 100.0.


So I began to play in the repl to try understand some things.


: (== 1.0 1.0)
-> T
: (== 10.0 10.0)
-> T
: (== 100.0 100.0)
-> T
: (scl 5)
-> 5
: (== 1.0 1.0)
-> T
: (== 10.0 10.0)
-> T
: (== 100.0 100.0)
-> T
: (scl 9)
-> 9
: (== 1.0 1.0)
-> T
: (== 10.0 10.0)
-> T
: (== 100.0 100.0)
-> T
: (scl 17)
-> 17
: (== 1.0 1.0)
-> T
: (== 10.0 10.0)
-> T
: (== 100.0 100.0)
-> NIL
:


What am I not understanding? Or am I just gifted at finding edge cases. :)

Thanks for any help.

Jimmie


Re: Fixpoint Numbers strange problem

2021-12-19 Thread Jo-To Schäg
Reading the docs:

: (help '==)
> 
> (== 'any ..) -> flg
> Returns T when all any arguments are the same (pointer equality). See also
> n==
> and Comparing.
>
> 
>
You are checking pointer equality once the number is big enough to spill
into a different cell they are no longer pointer equal

> : (help '=)
> 
> (= 'any ..) -> flg
> Returns T when all any arguments are equal (structure equality). See also
> Comparing.
>
> 
>
Is what you want


On Sun, 19 Dec 2021 at 23:32, Jimmie Houchin  wrote:

> I am exploring PicoLisp again after several years. The idea of PicoLisp is
> so very appealing. It is getting my reality to fit in its idea.
>
> I have revisited my original problem from this thread.
>
> https://www.mail-archive.com/picolisp@software-lab.de/msg07561.html
>
>
> At that time I still could not get the PicoLisp version to numbers to be
> equivalent with all other platforms I tested.
>
> ...
>
> (de loop1calc (I J N)
>(let V (*/ N (+ I N) (- J N) 0.1234567 `(* 1.0 1.0 1.0))
>   (normalize (*/ V V V `(* 1.0 1.0)) ) ) )
>
> (de loop2calc (I J N)
>(normalize
>   (*/ N
>  (+ J 1.0)
>  (+ N N N)
>  0.1234567
>  `(* 1.0 1.0 1.0) ) ) )
>
> ...
>
>
> When I reverse the names of these functions. What is normally loop2calc
> produces the same results as the other implementations. So it is what is
> the loop1calc function that is bringing the difference.
>
> So I began to add print statements to the loop to discover the values.
>
> (if (= I 1.0) ... )
>
>
> I have (scl 17) in my current file.
>
> I wanted to see what was at the end of the looping and I did (if (= I
> 100.0) ... ) to get the last loop and printed nothing. However when I did
> (if (> I 99.0) ... ) it printed some values for loop 100.0.
>
> So I began to play in the repl to try understand some things.
>
>
> : (== 1.0 1.0)
> -> T
> : (== 10.0 10.0)
> -> T
> : (== 100.0 100.0)
> -> T
> : (scl 5)
> -> 5
> : (== 1.0 1.0)
> -> T
> : (== 10.0 10.0)
> -> T
> : (== 100.0 100.0)
> -> T
> : (scl 9)
> -> 9
> : (== 1.0 1.0)
> -> T
> : (== 10.0 10.0)
> -> T
> : (== 100.0 100.0)
> -> T
> : (scl 17)
> -> 17
> : (== 1.0 1.0)
> -> T
> : (== 10.0 10.0)
> -> T
> : (== 100.0 100.0)
> -> NIL
> :
>
>
> What am I not understanding? Or am I just gifted at finding edge cases. :)
>
> Thanks for any help.
>
> Jimmie
>