Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Divisible result as a whole number

Featured Replies

I think this may be a quick one. I want a function that returns a Boolean result if a number is divisible by 4 ie it returns a whole number when divided by 4.

Is this possible.

Many thanks

The following function will return 1 if a number is evenly divisible by 4. It will return 0 otherwise.

If the number is zero it will return 0. This is an arbitrary choice, but since you asked for a whole number instead of an integer, that indicated to me that you needed a zero result when given zero as input.

Case(

theNumber = 0; 0; /* Make this result 1 if your logic

Mod(theNumber; 4) = 0; 1;

0

)

This:

returns a Boolean result if a number is divisible by 4

is NOT the same as:

it returns a whole number when divided by 4.

A Boolean result is either True (1) or False (0). To get a Boolean result if a number is divisible by 4, you can use =

not Mod ( number ; 4 )






To return a whole number when divided by 4 ... well it depends on whether you want to round, or discard the remainder, or whatever. The simplest way is:




Div ( number ; 4 )

which performs an integer division (i.e. any remainder is discarded).

you asked for a whole number instead of an integer

The difference being... ?

The difference being... ?

I may be misremembering my elementary school math terminology. I thought a whole number was a "counting number", i.e. positive integers.

Integers of course can be zero and negative.

My dictionary defines "integer" as "a whole number". But it is true that the term does not have a precise definition and some use it to mean "a natural number".

  • Author

Hi sorry did not intend to create a debate. I should have been clearer. Basically what I was looking for is if a number in this case a year was divisible by four (and would therefore denote a leap year) it would trigger conditional formating on the field I have for 29th Feb.

The not Mod ( number ; 4 ) worked like a dream

Thank you all for your help.

a year was divisible by four (and would therefore denote a leap year)

That's not a good test - it will fail in 2100. Try =

not Mod ( Year ; 4 ) and Mod ( Year ; 100 ) or not Mod ( Year ; 400 ) 




or =




Month ( Date ( 2 ; 29 ; Year ) ) = 2

... or:

DayOfYear( Date( 12 ; 31 ; Year ) ) = 366

... but this is kind-of the same as Month ( Date ( 2 ; 29 ; Year ) ) = 2

  • 3 weeks later...
  • Author

If they are still using this databased in 2100 I will be impressed, although probably dead haha.

Thanks for the tip though will change my code.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.