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

[REBOL] Re: percent! - new datatype request

From: chalz:earthlink at: 7-Jun-2002 1:12

I'm coming in to this discussion a little late, but here's the way I, personally, would see it.
> 100 - 50% == 50 ; as first stated
This, to me, would equate to: 100 - (100 * .50) == 50 Similarly: 200 - 50% == 200 - (200 * .5) == 100
> I suppose > 50% - 100 == -50% ; ? or should be illegal?
I don't think you could really do that, because just what is that 50% *of*? Perhaps 50% - 100% ..
> And > 50% * 100 == 5000% > 100 * 50% == 50
An interesting thought. Should 100 + 50% == 100 + (100 * .5) and 100 * 50% == 100 * .5 ? 50% * 100, though.. I can see where that would be believable. :/
> > Shouldn't that be > > > > >> 100 - 50% > > == 50%
Not necessarily. It'd be 100 minus 50% of 100, which is 50. Otherwise, you should stick with 100% - 50% = 50%..
> > and thus > > > > >> rate: 8.25% > > == 8.25% > > >> price: $100.00 > > == $100.00 > > >> tax: price * rate > > == $8.25
Precisely; the datatype of the first value, the value upon which the percent is being acted, should be the returned datatype. No?
> > >> taxrate: to-percent [$8.25 / $100] > > == 8.25%
to-percent on type block! ? I don't see why. Use parens, perhaps, if you feel the need, but traxrate: to-percent $8.25 / $100 should be fine. Results in (8.25E-2 * 100), more or less. Some related, interesting behavior. You can do money! + money!, money! - money!, money! / money!, but not money! * money!. Heh. money! / money! results in number!. (I like how integer! and decimal! values all fall under the category number! .. workes nicely.) --Charles