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

convert money values to integer?

 [1/13] from: kpeters:otaksoft at: 26-Aug-2007 12:25


Wow - I expected this to work: a: $100 print to-integer a a: %=$4.95 print to-decimal a So what do you use for this simple? conversion? Thanks, Kai

 [2/13] from: dhsunanda:g:mail at: 16-Aug-2007 10:07


Kai:
> a: $100 > So what do you use for this simple? conversion?
a/2 == 100.0 Sunanda

 [3/13] from: christian:ensel:gmx at: 26-Aug-2007 21:42


a: $100.95 print to-integer second a print round second a etc. HTH, Christian Kai Peters schrieb:

 [4/13] from: dockimbel:free at: 26-Aug-2007 21:46


As explained in http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.4
>> a: $100
== $100.00
>> second a
== 100.0
>> type? second a
== decimal! I agree that 'to-integer and 'to-decimal should work on money! type. Can someone RAMBO that if it's not already there ? -- DocKimbel Kai Peters wrote:

 [5/13] from: tim-johnsons:web at: 26-Aug-2007 12:00


On Sunday 26 August 2007, Kai Peters wrote:
> Wow - I expected this to work: > > a: $100
Strings are handy for that...
> print to-integer a >> to-integer next to-string a
== 100 ;; next:
> a: %=$4.95
I'm not sure of assignment above. Did you mailer add something? ;; similarly:
>> a: $4.95
== $4.95

 [6/13] from: kpeters::otaksoft::com at: 26-Aug-2007 12:56


Thanks for the super-prompt help everybody! Had skimmed the Core Manual (more the examples, to be honest) and thus not read about the fact that money! is a hybrid two-part datatype - now it makes sense! Thanks again, Kai

 [7/13] from: tim-johnsons::web::com at: 26-Aug-2007 14:43


On Thursday 16 August 2007, Sunanda wrote:
> Kai: > > a: $100 > > So what do you use for this simple? conversion? > > a/2
Say what? Well, I just learned something new! On a related note, look here:
>> t: now/date
== 26-Aug-2007
>> t/1
== 2007
>> t/2
== 8
>> t/3
== 26 ;; but the path referencing is counter-intuitive ;; (to me anyway) Tim

 [8/13] from: kpeters:otaksoft at: 26-Aug-2007 17:51


Hmm, I did not read up on it yet but it would seem as if dates are kept in ISO format yyyy-mm-dd internally and thus we would see what you describe below?? Kai

 [9/13] from: tim-johnsons::web::com at: 26-Aug-2007 19:05


On Sunday 26 August 2007, Kai Peters wrote:
> Hmm, I did not read up on it yet but it would seem as if dates are kept in > ISO format yyyy-mm-dd internally and thus we would see what you > describe below??
I think you nailed it. referencing path/indexes on 'now (without the /date refinement) appears consistant with ISO. tim

 [10/13] from: gregg:pointillistic at: 26-Aug-2007 22:37


Hi Tim, TJ> Well, I just learned something new! TJ> On a related note, look here:
>>> t: now/date
TJ> == 26-Aug-2007
>>> t/1
TJ> == 2007
>>> t/2
TJ> == 8
>>> t/3
TJ> == 26 TJ> ;; but the path referencing is counter-intuitive TJ> ;; (to me anyway)
>> make date! [2007 4 16]
== 16-Apr-2007 -- Gregg

 [11/13] from: compkarori:gmai:l at: 27-Aug-2007 17:10


What annoys me is that you can't do now/1 .. now/2 .. now/3 etc. On 8/27/07, Gregg Irwin <gregg-pointillistic.com> wrote:
> >> make date! [2007 4 16] > == 16-Apr-2007 > > -- Gregg > > -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. >
-- Graham Chiu http://www.synapsedirect.com Synapse-EMR - innovative electronic medical records system

 [12/13] from: carl:cybercraft at: 27-Aug-2007 18:37


On Monday, 27-August-2007 at 17:10:41 Graham Chiu wrote,
>What annoys me is that you can't do now/1 .. now/2 .. now/3 etc.
Try this! ... old-now: :now now: reduce [ does [first old-now] does [second old-now] does [third old-now] does [fourth old-now] does [fifth old-now] none none none 'year does [first old-now] 'month does [second old-now] 'day does [third old-now] 'time does [fourth old-now] 'zone does [fifth old-now] 'date does [old-now/date] 'weekday does [old-now/weekday] 'yearday does [old-now/yearday] 'precise does [old-now/precise] ]
>> now/1
== 2007
>> now/year
== 2007
>> now/2
== 8
>> now/month
== 8
>> now/4
== 18:30:41
>> now/4
== 18:30:43
>> now/time
== 18:30:51
>> now/date
== 27-Aug-2007
>> now/precise
== 27-Aug-2007/18:31:05.406+12:00 However, unfortunately...
>> now/time/precise
** Script Error: time has no refinement called precise ** Near: now/time/precise Close though! :-) -- Carl Read.

 [13/13] from: tim-johnsons:web at: 27-Aug-2007 7:07


On Sunday 26 August 2007, Carl Read wrote: Very usable! Thanks Carl tim