Re: Floating Point numbers vs Fixpoint numbers

2017-08-12 Thread Danilo Kordic
I think it can be either way. It was just slightly more convenient for me to make it negative so I can use existing `read'er like ``(Scl 1.0 *Scl)''. As the comment in `Scl' should explain the intended meaning of `Scl' is ``(= (Scl S E) (* S (** 10 E)))''. If ``1.0'' becomes ``100'' then

Re: Floating Point numbers vs Fixpoint numbers

2017-08-11 Thread Alexander Burger
Hi Danilo, On Fri, Aug 11, 2017 at 02:35:21PM +0200, Danilo Kordic wrote: > : [load 'Scl.l] > : [symbols 'Scl.l 'pico] > : [scl -20] I did not check thoroughly yet, but why a negative scale? ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Floating Point numbers vs Fixpoint numbers

2017-08-11 Thread Danilo Kordic
: [load 'Scl.l] : [symbols 'Scl.l 'pico] : [scl -20] : (* (* (Scl 9.9 *Scl) (Scl 9.789 *Scl)) (Scl 9.56789 *Scl)) -> (Scl 927234744579000 -60) : (normalize @) -> (Scl 927234744579 -9) : [setq N @ A (Scl 927.23474457900010747835 *Scl)] : (- A N) #

Re: Floating Point numbers vs Fixpoint numbers

2017-08-11 Thread Danilo Kordic
: [load 'Scl.l] : [symbols 'Scl.l 'pico] : [scl -20] : (* (* (Scl 9.9 *Scl) (Scl 9.789 *Scl)) (Scl 9.56789 *Scl)) -> (Scl 927234744579000 -60) : (normalize @) -> (Scl 927234744579 -9) : [setq N @ A (Scl 927.23474457900010747835 *Scl)] : (- A N) #

Re: Floating Point numbers vs Fixpoint numbers

2017-07-26 Thread Jimmie Houchin
Thanks for the reply. My apologies for so long a delay in replying. Work jumped up and slapped me real hard last week. No time for anything else. :( On 07/15/2017 05:52 AM, Alexander Burger wrote: Hi Jimmie, thanks for your long feedback and sharing your experiences! I have spent a fair

Re: Floating Point numbers vs Fixpoint numbers

2017-07-15 Thread Jakob Eriksson
Oh, that was quite mundane - as most bugs are when found. :) Huge props to you for finding it so very fast. On 2017-07-15 14:45, Alexander Burger wrote: > On Sat, Jul 15, 2017 at 02:02:00PM +0200, Jakob Eriksson wrote: >> What was it? > > The diff is: > >2460a2461 >> push ZERO

Re: Floating Point numbers vs Fixpoint numbers

2017-07-15 Thread Alexander Burger
On Sat, Jul 15, 2017 at 02:02:00PM +0200, Jakob Eriksson wrote: > What was it? The diff is: 2460a2461 > push ZERO # Safe 2489,2490c2490,2491 < ld E (L I) # Get product < ld (L I) A # Save halved argument call adduAE_A # Add for rounding ---

Re: Floating Point numbers vs Fixpoint numbers

2017-07-15 Thread Jakob Eriksson
What was it? On 2017-07-15 13:51, Alexander Burger wrote: > On Sat, Jul 15, 2017 at 12:52:52PM +0200, Alexander Burger wrote: >> I cound not locate the exact location of the bug yet. It is a Heisenbug, >> because >> it only occurs if the garbage collector runs in the right moment. I know this

Re: Floating Point numbers vs Fixpoint numbers

2017-07-15 Thread Alexander Burger
On Sat, Jul 15, 2017 at 12:52:52PM +0200, Alexander Burger wrote: > I cound not locate the exact location of the bug yet. It is a Heisenbug, > because > it only occurs if the garbage collector runs in the right moment. I know this > ... > I will dig into it now, to find and fix it, and release a

Re: Floating Point numbers vs Fixpoint numbers

2017-07-15 Thread Alexander Burger
Hi Jimmie, thanks for your long feedback and sharing your experiences! > I have spent a fair amount of the last 4 days playing with PicoLisp. I Yess. From your code I see that you master PicoLisp already quite well! I suspect that you gave up just a little bit too early. > : (scl 12) > -> 12

Re: Floating Point numbers vs Fixpoint numbers

2017-07-14 Thread Jimmie Houchin
I would like to thank all that helped with questions. My apologies for the very, very, very long message below. I tried to detail my recent experiences. I have spent a fair amount of the last 4 days playing with PicoLisp. I thought I would give it a try even though it is quite primitive

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Alexander Burger
Hi Jimmie, > What I didn't see in any of the examples is this > > : (format (*/ 9.9 9.789 9.56789 `(* 1.0 1.0)) *Scl) >-> "927.234744579000" Good idea! I added this example to the reference of '*/' ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Jimmie Houchin
Hello, Thanks for all the help. It is a little more complicated than in languages with support for floating point, but it appears manageable. I think I am slowly wrapping my mind around it. What I didn't see in any of the examples is this : (format (*/ 9.9 9.789 9.56789 `(* 1.0 1.0)) *Scl)

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Alexander Burger
Hi Jimmie, the key is to use the '*/' function for both multiplication and division. '*' is not very useful here. > : (format (* 9.9 9.789 9.56789) 20) > -> "927234744579000." Instead, try : (scl 20) -> 20 : (format (*/ 9.9 9.789

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Christophe Gragnic
On Wed, Jul 12, 2017 at 8:36 PM, Jimmie Houchin wrote: > > I didn't know if PicoLisp provided a solution without complicating every > function which uses multiplication and division. Yes, the */ function: http://software-lab.de/doc/ref_.html#*/ I think you just have to

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Alexander Burger
On Wed, Jul 12, 2017 at 08:05:42PM +0200, Aatos Heikkinen wrote: > I´ve found ´format´ and ´round´ functions quite helpful, see > https://the-m6.net/blog/fixed-point-arithmetic-in-picolisp.html Yes, this article describes it very well. Especially, it explains Jimmie's issues with multiplication

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Jimmie Houchin
Yes, I understand. But not without complicating the calculation to keep track of the number of times I have done multiplication in the current result. Formating with current scale does not work. : (format (* 9.9 9.789 9.56789) 20) ->

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Aatos Heikkinen
I´ve found ´format´ and ´round´ functions quite helpful, see https://the-m6.net/blog/fixed-point-arithmetic-in-picolisp.html On 12 Jul 2017 18:52, "Jimmie Houchin" wrote: > Hello, > > I am trying to understand something about PicoLisp and Fixpoint numbers. > > I am writing

Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Jimmie Houchin
Hello, I am trying to understand something about PicoLisp and Fixpoint numbers. I am writing an app and would consider PicoLisp should I get my head around Lisp. But I do not understand how to use numbers. I use a lot of floating point numbers and lots of calculations. From simple