# Re: Floating point arithmetic

```Hello Alex,

Thanks for the detailed answer and thanks for PicoLisp!```
```
-- Vijay

On Wed, Aug 25, 2010 at 5:34 PM, Alexander Burger <a...@software-lab.de> wro=
te:
> Hi Vijay,
>
>> How can I do floating point arithmetic in PicoLisp? Is there an
>> example of fixed-point division?
>
> As your question seems to correctly presume, there is no real floating
> point arithmetic in PicoLisp.
>
> Fixed point numbers are actually scaled integer numbers. So a division
> always requires a multiplication with the scale _before_ actually
> dividing the numbers, and a multiplication needs a division by the scale
> _after_ multiplying the arguments.
>
> In both cases, the '*/' function (muldiv) is normally used. In addition
> to being faster than separate calls to '*' and '/', '*/' also rounds the
> result.
>
>
> For example:
>
> : (scl 6) =A0# Use a scale of 1000000
> -> 6
>
>
> # Division
> : (*/ 17.0 1.0 3.0) =A0# Divide 17 by 3
> -> 5666667
>
> : (format @ *Scl) =A0# See it as fixpoint
> -> "5.666667"
>
>
> # Multiplication
> : (*/ 12.345 0.99 1.0) =A0# Multiply 12.345 with 0.99
> -> 12221550
>
> : (format @ *Scl)
> -> "12.221550"
>
>
> As you see, the scale (1000000) can be specified conveniently as 1.0.
>
> Does this help?
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
--
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
```