Re: Returning double results in pil21 ?
Hi Andras, > My post is indicated by Mia’s blog entry ;) since I have cross-checked the > results > between pil21 and my 64bit pil32 fork. Ah, nice! :) Anyway this double to pil number conversion was not the problem here. > pil32 flawlessly converted double results to bignums, but I understand the > efficiency > consideration. Oh, cool, I did not remember. Indeed, doubleToNum() in big.c does that. Perhaps this was kind of easier, because pil32 had *only* bignums ;) ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
Hi Alex, My post is indicated by Mia’s blog entry ;) since I have cross-checked the results between pil21 and my 64bit pil32 fork. pil32 flawlessly converted double results to bignums, but I understand the efficiency consideration. Thanks, Andras Pahi > On 2021. Sep 29., at 16:37, Alexander Burger wrote: > > On Wed, Sep 29, 2021 at 04:28:20PM +0200, Alexander Burger wrote: >> BTW, pil64 did the same. > > Side note: Mia's blog from today has an interesting case of floating point > versus fixpoint. > > PicoLisp fixpoint arithmetics turns out to be superior: > > https://picolisp-blog.hashnode.dev/the-fibonacci-sequence > > It is the implementation of Binet's formula at the end. > > ☺/ A!ex > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
On Wed, Sep 29, 2021 at 04:28:20PM +0200, Alexander Burger wrote: > BTW, pil64 did the same. Side note: Mia's blog from today has an interesting case of floating point versus fixpoint. PicoLisp fixpoint arithmetics turns out to be superior: https://picolisp-blog.hashnode.dev/the-fibonacci-sequence It is the implementation of Binet's formula at the end. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
Hi Alex, I understand that the result will be correct for 56bits only (as for every double FP number), but we lose the dynamic range. So pil21 will only return 60bits worth of doubles ;) Thanks, Andras Pahi > On 2021. Sep 29., at 16:16, Alexander Burger wrote: > > Ah, yes, that's correct. This is because even a double has only 56 bits of > precision, so the 60 bits of a short number should be enough. -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
On Wed, Sep 29, 2021 at 04:16:32PM +0200, Alexander Burger wrote: > Ah, yes, that's correct. This is because even a double has only 56 bits of > precision, so the 60 bits of a short number should be enough. BTW, pil64 did the same. You *could* build also bignums of course, but where to stop? It might result in very long chains of bignum cells if the floating point number has a big exponent. So I think this decision was also an efficiency consideration. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
On Wed, Sep 29, 2021 at 04:05:21PM +0200, Andras Pahi wrote: > I mean that in pil21 src/lib.c boxFloat() and boxDouble() restricts the range > of float/doubles to short numbers only… Ah, yes, that's correct. This is because even a double has only 56 bits of precision, so the 60 bits of a short number should be enough. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
Hi Alex, Thanks. I mean that in pil21 src/lib.c boxFloat() and boxDouble() restricts the range of float/doubles to short numbers only… Thanks, Andras Pahi > On 2021. Sep 29., at 15:41, Alexander Burger wrote: > > Hi Andras, > >> As I see, the native function with the scaled fixpoint specification can >> return only a short number ? >> Is it a bug or a feature ? > > It can also return a 'double'. A single precision 'float' number is returned > via > the -1.0 spec, and a 'double' is returned via the +1.0 spec. > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Returning double results in pil21 ?
Hi Andras, > As I see, the native function with the scaled fixpoint specification can > return only a short number ? > Is it a bug or a feature ? It can also return a 'double'. A single precision 'float' number is returned via the -1.0 spec, and a 'double' is returned via the +1.0 spec. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Returning double results in pil21 ?
Hi, As I see, the native function with the scaled fixpoint specification can return only a short number ? Is it a bug or a feature ? Thanks, Andras Pahi -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe