Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Mod function with odd interest amount

Status
Not open for further replies.

Corinne30

Programmer
Mar 24, 2011
16
0
1
US
I have a calculation that I need some help with.

The users need to enter an interest amount and then that amount gets divided by 2 and the results of that are then either multiplied by .25 or .75.

My problem comes when the interest amount is an odd amount like .09 How can I use the mod function to determine if its odd so that I can create one formula to multiply .05 * .25 and .04 * .75
rather that .045 * .25 and .045 * .75?

Thanks for any help

Corinne

 
Not sure I understand your ultimate goal but .... Multiply your cents by 100 then use mod..

Example:
(.09 * 100) mod 2 will equal 1
(.08 * 100) mod 2 will equal 0
(.07 * 100) mod 2 will equal 1
(.06 * 100) mod 2 will equal 0
(.05 * 100) mod 2 will equal 1
(.04 * 100) mod 2 will equal 0
(.03 * 100) mod 2 will equal 1
(.02 * 100) mod 2 will equal 0
(.01 * 100) mod 2 will equal 1

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top