Rounding

Hello!

I'm building a Case statement to round UP to the nearest tenth:

Case (
Box_Weight-Int ( Box_Weight ) =0;Box_Weight;
Box_Weight-Int ( Box_Weight ) <.1;Int ( Box_Weight )+.1;
Box_Weight-Int ( Box_Weight ) <.2;Int ( Box_Weight )+.2;
Box_Weight-Int ( Box_Weight ) <.3;Int ( Box_Weight )+.3;
Box_Weight-Int ( Box_Weight ) <.4;Int ( Box_Weight )+.4;
Box_Weight-Int ( Box_Weight ) <.5;Int ( Box_Weight )+.5;
Box_Weight-Int ( Box_Weight ) <.6;Int ( Box_Weight )+.6;
Box_Weight-Int ( Box_Weight ) <.7;Int ( Box_Weight )+.7;
Box_Weight-Int ( Box_Weight ) <.8;Int ( Box_Weight )+.8;
Box_Weight-Int ( Box_Weight ) <.9;Int ( Box_Weight )+.9;
Box_Weight-Int ( Box_Weight ) ≤ .99;Int ( Box_Weight )+1;
)

I can't make a Box_Weight of 1.80 read 1.8, it reads 1.9.
1.60 calculates to 1.7 etc. etc.

What am I doing wrong? I cannot get my head around it!

Thank you!

Why not just like this?

Ceiling ( Box_Weight * 10 ) / 10

P.S.to have your Case work, replace the <.x by <=.x

7 Likes

.....Why? Because i had no idea the Ceiling function even existed!!

That's actually quite amazing; thank you. The simplicity is great.

Thanks again.

1 Like