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" <jlhouc...@gmail.com> wrote:

> 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 experiments it seems that the numbers and math appear to be accurate
> and correct. However I have no understanding of how to present a final
> result formatted correctly.
>
> Example:
>
> (setq *Scl 5) ;; or could be 10 ...
>
> (* 0.00009 0.0009)
>
> -> 81
>
> From another language: 0.0000000081
>
> or:
>
> (setq *Scl 20)
>
> (* 9.9 9.789 9.56789)
>
> -> 927234744579000000000000000000000000000000000000000000000000000
>
> From another language 20 decimal points printed after converting to
> floating point:
>
> 927.23474457900010747835
>
> The math looks fine as far as these simple examples go. But if I do
> several to dozens of different calculations with floating point numbers
> with unknown values until streamed to the app from some source. How do I
> know where the decimal point really belongs in order to format correctly
> for human use? Is it possible?
>
> I personally do not have a problem with fixpoint for internal use, as that
> is simply an implementation issue. However I do need to convert back to the
> best floating point representation for display or storage.
>
> Any help in understanding would be greatly appreciated.
>
> Thanks.
>
> Jimmie
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to