Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

formatting of decimal value

 [1/7] from: dlhawley::home::com at: 21-Dec-2000 10:37


I've looked through the wole dictionary and don't see a quick method for converting a decimal! to a string! with a specified format. I C I'd do something like: sprintf( destString, "%.2f", number); Is there something similar in REBOL or do I need a function? -- David L. Hawley D.L. Hawley and Associates 1.503.274.2242 Software Engineer [David--L--Hawley--computer--org]

 [2/7] from: lmecir:mbox:vol:cz at: 22-Dec-2000 0:30


Hi, check http://www.rebol.org/math/format.r ----- Original Message ----- From: David Hawley <[dlhawley--home--com]> To: <[rebol-list--rebol--com]> Sent: Thursday, December 21, 2000 7:37 PM Subject: [REBOL] Re: formatting of decimal value
> I've looked through the wole dictionary and don't see a quick method for
converting a decimal! to a string! with a specified format. I C I'd do something like:

 [3/7] from: rchristiansen:pop:isdfa:sei-it at: 21-Dec-2000 17:36


Use 'reform, as such...
>> decimal-value: make decimal! 1
== 1
>> decimal? decimal-value
== true
>> string-value: make string! (reform decimal-value)
== "1"
>> string? string-value
== true
>>
-Ryan

 [4/7] from: larry:ecotope at: 21-Dec-2000 15:50


Hi David This is one of the most irritating shortcomings of REBOL. It provides NO method of formatting floating point numbers, other than it's default. There are some scripts at http://www.rebol.orgwhich will do this. The most comprehensive and accurate is format.r by Eric Long. -Cheers Larry ----- Original Message ----- From: David Hawley <[dlhawley--home--com]> To: <[rebol-list--rebol--com]> Sent: Thursday, December 21, 2000 10:37 AM Subject: [REBOL] Re: formatting of decimal value
> I've looked through the wole dictionary and don't see a quick method for
converting a decimal! to a string! with a specified format. I C I'd do something like:

 [5/7] from: al:bri:xtra at: 22-Dec-2000 16:19


> I've looked through the wole dictionary and don't see a quick method for
converting a decimal! to a string! with a specified format. I C I'd do something like:
> sprintf( destString, "%.2f", number); > > Is there something similar in REBOL or do I need a function?
There was mentioned quite some time back that Carl was thinking of a better method for formatting numbers. Presumably this will arrive with printing for Rebol some time in the future. The best alternative so far is Ladislav's functions. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [6/7] from: lmecir:mbox:vol:cz at: 22-Dec-2000 7:33


Hi, not mine, I didn't write the functions Regards Ladislav

 [7/7] from: al:bri:xtra at: 22-Dec-2000 20:20


> not mine, I didn't write the functions
Whoops! Sorry Ladislav. They're [insert your name here]'s functions, and they're available at: http://www.rebol.org? Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/