Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 020: MOD
#2
(11-28-2022, 02:00 AM)SMcNeill Wrote: If one needs positive values as a result from MOD, simply write a small function to get the answer in a format which you can work with:

Code: (Select All)
FUNCTION ModPositive&& (number as _INTEGER64, number2 AS LONG)
    temp&& = number MOD number2 
    IF temp&& < 0 THEN temp&& = temp&& + number
    ModPositive = temp&&
END FUNCTION
Disclaimer: in case one wants to blame the forum moderators for "it crashed and I lost my data", there should be a check for "number2" to be zero. Or just let it at the first function line, errrr...
Reply


Messages In This Thread
DAY 020: MOD - by SMcNeill - 11-28-2022, 02:00 AM
RE: DAY 020: MOD - by mnrvovrfc - 11-28-2022, 02:28 AM
RE: DAY 020: MOD - by TerryRitchie - 11-28-2022, 02:32 AM
RE: DAY 020: MOD - by bplus - 11-28-2022, 02:46 AM
RE: DAY 020: MOD - by Pete - 11-28-2022, 03:31 AM
RE: DAY 020: MOD - by Pete - 11-28-2022, 04:11 AM
RE: DAY 020: MOD - by vince - 11-28-2022, 01:45 PM
RE: DAY 020: MOD - by OldMoses - 11-28-2022, 08:36 PM



Users browsing this thread: 4 Guest(s)