Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Math Whiz - Frankenbach ?
Message
From
16/02/2005 09:29:54
 
 
To
15/02/2005 21:45:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00987308
Message ID:
00987403
Views:
43
>I knew I shouldn't have majored in history.

Just thank God it wasn't sociology. :)

>I need to divide a value v into n integers i where n is fixed and if mod(v,n)>0 then the first n-1 i's must be equal with the nth i being the mod
>
>Does that make sense? If I divide 10 into 4 parts i need 3,3,3,1

Can't answer the part about sense.

Here are some code "notes" about the other part:
CLEAR

v = 10^10 + 459  &&14912   &&243   &&15  &&10  &&1787  &&27
n = 10           &&7       &&5     &&4   &&3   &&14    &&5

nRemainder = INT(v%n)
nIntCount = n

IF nRemainder > 0
	nIntCount = nIntCount - 1
	nInteger = INT( v / (n-1) )
	nRemainder = v%nInteger
ELSE
	nInteger = v/n
ENDIF

? nInteger
? nRemainder
? (nInteger * nIntCount) + nRemainder

RETURN
Christopher Bohling, Consultant
http://www.ChristopherBohling.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform