How to round a real number?

103 views Asked by At

Say I wanted to round a real number to a natural number, how could I do this in VDM++? The MATH library does not appear to have any function that does this.

Thanks, Ricardo

1

There are 1 answers

1
Nick Battle On BEST ANSWER

There is a "floor" operator in VDM. This returns the largest integer that is less than or equal to its argument.

> p floor 1.23
= 1
Executed in 0.034 secs. 
> p floor -1.23
= -2
Executed in 0.002 secs. 
> p floor 123
= 123
Executed in 0.001 secs. 
>