### Round function

Posted:

**Wed Jul 02, 2003 1:48 pm**TO ALL PASCAL PROGRAMMER'S...

I think there was an error with the FreePascal's

What should be the result of Round(1.5)? 2! (right)

And what should be the result of Round(2.5)? 3! (wrong!!!)

Run the following program and confirme the results...

[pascal]

Var

i : Integer;

Begin

For i:=0 To 10 Do

WriteLn(i:3,' ', i+0.5, (i+0.5):5:1, (i+0.5):3:0,Round(i+0.5):3)

End.

[/pascal]

And what about the output formatting of reals (x

Run the following program and observe the third and fourth column:

[pascal]

Var

i : Integer;

Begin

For i:=0 To 10 Do

WriteLn(i:3,' ', i+0.35, (i+0.35):5:1, (i+0.35):6:1)

End.

[/pascal]

I think many submissions gives WA 'cause of this bug (i speak by myself )

It's time to revise this error for benefict of competition.

(Sorry my poor english!)

Thanks!

I think there was an error with the FreePascal's

**Round**function (you should know by now!)What should be the result of Round(1.5)? 2! (right)

And what should be the result of Round(2.5)? 3! (wrong!!!)

Run the following program and confirme the results...

[pascal]

Var

i : Integer;

Begin

For i:=0 To 10 Do

WriteLn(i:3,' ', i+0.5, (i+0.5):5:1, (i+0.5):3:0,Round(i+0.5):3)

End.

[/pascal]

And what about the output formatting of reals (x

**:**places**:**decimals)...Run the following program and observe the third and fourth column:

[pascal]

Var

i : Integer;

Begin

For i:=0 To 10 Do

WriteLn(i:3,' ', i+0.35, (i+0.35):5:1, (i+0.35):6:1)

End.

[/pascal]

I think many submissions gives WA 'cause of this bug (i speak by myself )

It's time to revise this error for benefict of competition.

(Sorry my poor english!)

Thanks!