Author Topic: Hoe does DIV handle the remainder?  (Read 1238 times)

Offline BBarry

  • PLUS+1 Developer
  • ***
  • Posts: 14
  • Karma: +0/-0
Hoe does DIV handle the remainder?
« on: December 07, 2022, 10:41:34 PM »
Hi guys this may be a very basic question. I searched and could not find it spelled out anywhere.

How does the DIV function handle remainders (truncate it?) aka always round down to the nearest whole number?
I want to always round a number down and if DIV can do it for me great.

Warmest regards,

Offline Tor

  • Administrator
  • PLUS+1 Guru
  • *
  • Posts: 275
  • Karma: +26/-1
Re: Hoe does DIV handle the remainder?
« Reply #1 on: December 08, 2022, 09:02:46 AM »
Hello BBarry,

If you get a decimal number with the regular DIV component, it is truncated to zero decimal digits.  9/2=4  (Not stated/explained in the User Manual).
Then you have the Rounded divide that rounds up or down depending on what the reminder is. 9/2=5 (This is stated/explained in the User Manual).


I hope it helps.
Best regards,
Tor
PLUS+1® SW PAE Team

Offline niteRider

  • PLUS+1 Developer
  • ***
  • Posts: 45
  • Karma: +3/-0
Re: Hoe does DIV handle the remainder?
« Reply #2 on: December 08, 2022, 03:50:20 PM »
You can use the Modulo component to extract the remainder, too.

Offline BBarry

  • PLUS+1 Developer
  • ***
  • Posts: 14
  • Karma: +0/-0
Re: Hoe does DIV handle the remainder?
« Reply #3 on: December 08, 2022, 09:46:14 PM »
Thanks! That is exactly what I was looking for.