Decimal number to roman numeral 
Author Message
 Decimal number to roman numeral

Does anyone have a routine that converts a decimal number to roman numerals
that you wouldn't mind sharing with me?

I'd appreciate it. Thanks.

Doug



Sun, 04 Sep 2005 00:15:18 GMT  
 Decimal number to roman numeral
From Louis de Lacroix

PROCEDURE Romain
PARAMETERS tn
* Convertit en romain un entier < 10000
DO CASE
 CASE tn<10
  DO CASE
   CASE tn=0
    RETURN ""
   CASE tn>=1 AND tn<4
    RETURN "I"+romain(tn-1)
   CASE tn=4
    RETURN "IV"
   CASE tn>=5 AND tn<9
    RETURN "V"+romain(tn-5)
   CASE tn=9
    RETURN "IX"
  ENDCASE
 CASE tn>=10 AND tn<100
  DO CASE
   CASE tn<40
    RETURN "X"+romain(tn-10)
   CASE tn>=40 AND tn<50
    RETURN "XL"+romain(tn-40)
   CASE tn>=50 AND tn<90
    RETURN "L"+romain(tn-50)
   CASE tn>=90
    RETURN "XC"+romain(tn-90)
   ENDCASE
 CASE tn>=100 AND tn<1000
  DO CASE
   CASE tn<400
    RETURN "C"+romain(tn-100)
   CASE tn>=400 AND tn<500
    RETURN "CD"+romain(tn-400)
   CASE tn>=500 AND tn<900
    RETURN "D"+romain(tn-500)
   CASE tn>=900
    RETURN "CM"+romain(tn-900)
   ENDCASE
 CASE tn>=1000 AND tn<10000
    RETURN "M"+romain(tn-1000)
 OTHERWISE  && Si on a besoin de plus, on peut facilement adapter
  WAIT WINDOW "out of range..."  TIMEOUT 5 &&"Nombre trop grand... Programme
romain modifier"
ENDCASE

Enjoy!

Fred

Bonjour Doug Allan
Pour mmoire, tu nous as crit :

Quote:
> Does anyone have a routine that converts a decimal number to roman
> numerals that you wouldn't mind sharing with me?

> I'd appreciate it. Thanks.

> Doug



Sun, 04 Sep 2005 01:14:58 GMT  
 Decimal number to roman numeral
Hi Fred;

Thanks very much for the code. I really appreciate it.

Doug



Quote:
> From Louis de Lacroix

> PROCEDURE Romain
> PARAMETERS tn
> * Convertit en romain un entier < 10000
> DO CASE
>  CASE tn<10
>   DO CASE
>    CASE tn=0
>     RETURN ""
>    CASE tn>=1 AND tn<4
>     RETURN "I"+romain(tn-1)
>    CASE tn=4
>     RETURN "IV"
>    CASE tn>=5 AND tn<9
>     RETURN "V"+romain(tn-5)
>    CASE tn=9
>     RETURN "IX"
>   ENDCASE
>  CASE tn>=10 AND tn<100
>   DO CASE
>    CASE tn<40
>     RETURN "X"+romain(tn-10)
>    CASE tn>=40 AND tn<50
>     RETURN "XL"+romain(tn-40)
>    CASE tn>=50 AND tn<90
>     RETURN "L"+romain(tn-50)
>    CASE tn>=90
>     RETURN "XC"+romain(tn-90)
>    ENDCASE
>  CASE tn>=100 AND tn<1000
>   DO CASE
>    CASE tn<400
>     RETURN "C"+romain(tn-100)
>    CASE tn>=400 AND tn<500
>     RETURN "CD"+romain(tn-400)
>    CASE tn>=500 AND tn<900
>     RETURN "D"+romain(tn-500)
>    CASE tn>=900
>     RETURN "CM"+romain(tn-900)
>    ENDCASE
>  CASE tn>=1000 AND tn<10000
>     RETURN "M"+romain(tn-1000)
>  OTHERWISE  && Si on a besoin de plus, on peut facilement adapter
>   WAIT WINDOW "out of range..."  TIMEOUT 5 &&"Nombre trop grand...
Programme
> romain modifier"
> ENDCASE

> Enjoy!

> Fred

> Bonjour Doug Allan
> Pour mmoire, tu nous as crit :

> > Does anyone have a routine that converts a decimal number to roman
> > numerals that you wouldn't mind sharing with me?

> > I'd appreciate it. Thanks.

> > Doug



Sun, 04 Sep 2005 02:43:08 GMT  
 Decimal number to roman numeral
Thanks to our Louis national then ;)

Bonjour Doug Allan
Pour mmoire, tu nous as crit :

Quote:
> Hi Fred;

> Thanks very much for the code. I really appreciate it.

> Doug



>> From Louis de Lacroix

>> PROCEDURE Romain
>> PARAMETERS tn
>> * Convertit en romain un entier < 10000
>> DO CASE
>>  CASE tn<10
>>   DO CASE
>>    CASE tn=0
>>     RETURN ""
>>    CASE tn>=1 AND tn<4
>>     RETURN "I"+romain(tn-1)
>>    CASE tn=4
>>     RETURN "IV"
>>    CASE tn>=5 AND tn<9
>>     RETURN "V"+romain(tn-5)
>>    CASE tn=9
>>     RETURN "IX"
>>   ENDCASE
>>  CASE tn>=10 AND tn<100
>>   DO CASE
>>    CASE tn<40
>>     RETURN "X"+romain(tn-10)
>>    CASE tn>=40 AND tn<50
>>     RETURN "XL"+romain(tn-40)
>>    CASE tn>=50 AND tn<90
>>     RETURN "L"+romain(tn-50)
>>    CASE tn>=90
>>     RETURN "XC"+romain(tn-90)
>>    ENDCASE
>>  CASE tn>=100 AND tn<1000
>>   DO CASE
>>    CASE tn<400
>>     RETURN "C"+romain(tn-100)
>>    CASE tn>=400 AND tn<500
>>     RETURN "CD"+romain(tn-400)
>>    CASE tn>=500 AND tn<900
>>     RETURN "D"+romain(tn-500)
>>    CASE tn>=900
>>     RETURN "CM"+romain(tn-900)
>>    ENDCASE
>>  CASE tn>=1000 AND tn<10000
>>     RETURN "M"+romain(tn-1000)
>>  OTHERWISE  && Si on a besoin de plus, on peut facilement adapter
>>   WAIT WINDOW "out of range..."  TIMEOUT 5 &&"Nombre trop grand...
>> Programme romain modifier"
>> ENDCASE

>> Enjoy!

>> Fred

>> Bonjour Doug Allan
>> Pour mmoire, tu nous as crit :

>>> Does anyone have a routine that converts a decimal number to roman
>>> numerals that you wouldn't mind sharing with me?

>>> I'd appreciate it. Thanks.

>>> Doug



Sun, 04 Sep 2005 15:43:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Roman numeral sequencing algorithm?

2. Function for Roman numerals

3. Finding Out Number of Decimal Places

4. Appending and decimal numbers

5. Decimal number get truncated when converting from excel to dbf format

6. IBM AS/400 Packed decimal numbers?

7. Numbers Stored as an 8 byte floating point number

8. How to number or auto number invoices

9. Calculating Number of Days and Number of Months between 2 dates

10. decimal places ?

11. Currency field diplays too many decimal places

12. How to use , (comma) for decimal places?

 

 
Powered by phpBB® Forum Software