# Re: Scaled division and sqrt

```Hi Lindsay,

On Mon, Feb 27, 2017 at 06:28:15AM -0600, Erik Gustafson wrote:
> With '*/', I like to think of it like this: for multiplication, the scale
> factor is last, e.g.
>
>    (*/ X Y Scl)
>
> For division, the scale factor comes first, e.g.
>
>    (*/ Scl X Y)```
```
Exactly. The reason is simply that if you multiply two scaled integers, you have
to divide by the scale factor afterwards.

For example, assume your integers denote centimeters. You set *Scl to 2, so that

100 cm = 1.0 m

Now, one square meter is

1.0 m * 1.0 m  =  100 cm * 100 cm  =  1.0 m^2  =  10000 cm^2

As we want the result not in cm but in meters, we must divide by 100.
Example:

:(scl 2)
-> 2

: (*/ 3.0 4.0 1.0)  # This is equal to (*/ 300 400 100)
-> 1200

: (round @)
-> "12.00"

For division you need the opposite, multiply with 100 instead of dividing.
So you first multiply thi dividend by the scale factor before you divide:

(*/ 12.0 1.0 3.0)  # this is 12.0 / 3.0

If you multiply more than two numbers, you have to use the corresponding scale
factor:

: (*/ 3.0 4.0 5.0 `(* 1.0 1.0))  # 3.0 * 4.0 * 5.0
-> 6000

: (round @)
-> "60.00"

♪♫ Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
```