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

[REBOL] Re: Arithmetic shifts

From: carl:cybercraft at: 17-Aug-2004 19:43

>Hi Jorge, > >JAM> How can I perform an arithmetic shift (or a floored division) in >JAM> REBOL? > >to integer! value / radix
Note that to-integer (or to integer!) isn't always required to return an integer with division...
>> type? 3 / 2
== decimal!
>> type? 4 / 2
== integer!
>> type? 12 / 4
== integer! Which also allows us to do the likes of this...
>> x: 5 and 254 / 2
== 2
>> type? x
== integer! I suspect this has speed advantages too, though I've not done any tests. -- Carl Read