Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need Math Whiz - Frankenbach ?
Message
De
16/02/2005 09:29:54
Chris Bohling
Myers and Stauffer LC
Shawnee, Kansas, États-Unis
 
 
À
15/02/2005 21:45:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00987308
Message ID:
00987403
Vues:
42
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform