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)
   -> "927.23474457900000000000"

Where you are using (* 1.0 1.0) for the divisor. I had simply used 1.0 as in the examples, but because I had multiple values being multiplied I need to adjust the value of the divisor as you did. This is what I did not find in the examples is the divisor being adjusted accordingly to the number of values multiplied. That does fix it in this simple example.

Thanks again for yours and everyone's help. And thanks for the suggestion of the flight simulator.


Jimmie



On 07/12/2017 02:02 PM, Alexander Burger wrote:
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)
-> "9272347445790000000000000000000000000000000.00000000000000000000"
Instead, try

    : (scl 20)
    -> 20

    : (format (*/ 9.9 9.789 9.56789 `(* 1.0 1.0)) *Scl)
    -> "927.23474457900000000000"

or

    : (round (*/ 9.9 9.789 9.56789 `(* 1.0 1.0)))
    -> "927.235"

    : (round (*/ 9.9 9.789 9.56789 `(* 1.0 1.0)) 7)
    -> "927.2347446"


So in the example below I would have to track the number of arguments to the
* function. Then multiple that number against the current Scl value. In the
Yes. Perhaps you could look at the flight simulator in "misc/rcsim.l" in the
PicoLisp distribution. It defines a read macro MUL to keep track of the number
of multiplications.

♪♫ Alex



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

Reply via email to