Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extended KotD #25, #26, and #27: INTEGER DIVISION, CINT, and CLNG
#3
(05-04-2025, 12:26 PM)Jack Wrote:
Code: (Select All)

For i = 1 To 10
    x = i + .5
    Print x, CInt(x)
Next
gives
Code: (Select All)

1.5          2
2.5          2
3.5          4
4.5          4
5.5          6
6.5          6
7.5          8
8.5          8
9.5          10
10.5          10
it follows a simple rule
if integer-part is odd then round-up
if integer-part is even then round-down

Which is the nearest even integer.  Wink
Reply


Messages In This Thread
RE: Extended KotD #25, #26, and #27: INTEGER DIVISION, CINT, and CLNG - by SMcNeill - 05-04-2025, 12:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extended KotD #23 and #24: _MIN and _MAX SMcNeill 0 605 01-16-2025, 09:51 AM
Last Post: SMcNeill
  Extended KotD #22: _MOUSEHIDDEN SMcNeill 0 612 01-14-2025, 12:29 AM
Last Post: SMcNeill
  Extended KotD #20: _NOTIFYPOPUP SMcNeill 4 1,348 12-05-2024, 01:55 AM
Last Post: Pete
  Extended KotD #21: _MIDISOUNDBANK a740g 8 2,760 08-30-2024, 07:32 PM
Last Post: Steffan-68
  Extended KotD #19: _UCHARPOS SMcNeill 1 890 06-26-2024, 12:54 AM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: 1 Guest(s)