Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extended KotD #25, #26, and #27: INTEGER DIVISION, CINT, and CLNG
#9
Dang I did not know Integer division was a problem! (Giving results unexpected like CINT and CLNG which I never use anyway)

Round2 gives me results I'd prefer as expected, has this been proposed before? (expected round up on .5 or down if negative)
Code: (Select All)
For i = -5 To 5 Step .5
    Print i, round2&(i), _Round(i)
Next
Function round2& (x)
    If x < 0 Then round2& = -1 * Int(-x + .5) Else round2& = Int(x + .5)
End Function

I vaguely remember some conversation about rounding and Luke mentioning that rounding in QB64 was like bankers way of rounding .5's so that a balance of them doesn't accumulate a significant plus amount.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
RE: Extended KotD #25, #26, and #27: INTEGER DIVISION, CINT, and CLNG - by bplus - 05-04-2025, 03:20 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 609 01-14-2025, 12:29 AM
Last Post: SMcNeill
  Extended KotD #20: _NOTIFYPOPUP SMcNeill 4 1,334 12-05-2024, 01:55 AM
Last Post: Pete
  Extended KotD #21: _MIDISOUNDBANK a740g 8 2,752 08-30-2024, 07:32 PM
Last Post: Steffan-68
  Extended KotD #19: _UCHARPOS SMcNeill 1 886 06-26-2024, 12:54 AM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: 1 Guest(s)