Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert decimal to fraction
Message
De
10/02/2003 19:45:14
 
 
À
10/02/2003 19:14:34
Fabian Belo
Independent Developer
Argentine
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00751688
Message ID:
00751730
Vues:
29
The problem with this is that in most US applications this will have to restricted to ^2
like 1/2,1/4,1/16,1/32....

Peter


>I've made this function few weeks ago:
>
>
>FUNCTION _DecToFraction(nDec1)
>*-----------------------------------
>* Transforma de Decimal a Fraccion
>* Uso:  _DecToFraction(nDec1)
>* Devuelve:  Caracter
>*-----------------------------------
>	LOCAL cRes, nCon
>	nCon = 0
>	cRes = "No Fraction"
>	DO WHILE nCon<1000000
>		nCon = nCon+1
>		DO CASE
>			CASE MOD(nCon,nDec1)=0
>				cRes=ALLTRIM(STR(nCon))+"/"+ALLTRIM(STR(nCon/nDec1))
>				EXIT
>		ENDCASE
>	ENDDO
>	RETURN cRes
>ENDFUNC
>
>
>>I need to convert a decimal to a fraction... anyone have/know of a function for this?
>>
>>
>>.5 --> 1/2
>>
>>.1875 --> 3/16
>>
>>TIA
Peter Cortiel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform