Question: Round with units

The round(x) statement rounds x to the nearest integer but if x has unirs it appears not to work. Known bug?

RoundUnits.mw
 

> 

restart

> 

a := 15; b := 5.3

> 

c := (1/100)*a+b

5.450000000

(1)
> 

c := round(c)

5

(2)
> 

``

> 

A := 15*Unit('cm'); B := 5.3*Unit('m')

> 

C := A+B

15*Units:-Unit(cm)+5.3*Units:-Unit(m)

(3)
> 

C := simplify(C)

5.450000000*Units:-Unit(m)

(4)
> 

Cr := round(C)

round(5.450000000*Units:-Unit(m))

(5)
> 

``


 

Download RoundUnits.mw

 

Please Wait...