Sébastien’s Coding Journey

June 26, 2009

Rounding up in VBScript

Filed under: VBScript 5.8 — Tags: — Sébastien Ayotte @ 11:04 am

I didn’t find any functions that round up a number in VBScript. The Int function always round a negative number to the next integer. If you have -3.1 or -3.2 or -3.4 or -3.6 and you passe it to the Int function, you will optain -4.

I needed to round up positives integers. Knowing what the Int function can do to help me I wrote my own round up method.

public function roundUp(num)
    roundUp = -int(-num)
end function

Cheers :-)

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.