Author Topic: Gonna take a CINT-a-mental journey..  (Read 2945 times)

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Gonna take a CINT-a-mental journey..
« on: October 07, 2020, 07:18:04 pm »
Code: QB64: [Select]
  1. PRINT CINT(1 / 2) ' 0 Rounds down.
  2. PRINT CINT(2 / 2) ' 1
  3. PRINT CINT(3 / 2) ' 2 Rounds Up.
  4. PRINT CINT(4 / 2) ' 2
  5. PRINT CINT(5 / 2) ' 2 Rounds down.
  6. PRINT CINT(6 / 2) ' 3
  7. PRINT CINT(7 / 2) ' 4 Rounds Up.
  8. PRINT CINT(8 / 2) ' 4

What practical use does CINT have with this round up  then round down format?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Gonna take a CINT-a-mental journey..
« Reply #1 on: October 07, 2020, 07:33:59 pm »
Bilinear interpolation

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Gonna take a CINT-a-mental journey..
« Reply #2 on: October 07, 2020, 10:25:13 pm »
Bipolar interrogation? That could get nasty.... no it couldn't, yes it could!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Gonna take a CINT-a-mental journey..
« Reply #3 on: October 07, 2020, 10:30:10 pm »
Quote
Bipolar interrogation? That could get nasty.... no it couldn't, yes it could!

i genuinely lolled at this!
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Gonna take a CINT-a-mental journey..
« Reply #4 on: October 07, 2020, 11:11:20 pm »
Wait... it's not no it couldn't, yes it couldn't?

RE: OP
Luke apologized for the rounding as a Banker's method not wanting to show partiality so on average the accumulation of errors balance.
« Last Edit: October 07, 2020, 11:15:23 pm by bplus »