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

[REBOL] Type inconsistency in Arithmetic Functions

From: pwawood:gm:ail at: 11-Aug-2007 12:04

I feel the following behaviour is inconsistent:
>> type? 2 + 2
== integer!
>> type? 2 - 2
== integer!
>> type? 2 * 2
== integer!
>> type? 2 / 2
== integer!
>> type? 2 ** 2
== decimal! Both Python seems to return an integer:
>>> 2 ** 2
4
>>> 2.0 ** 2
4.0 As does Ruby: irb(main):002:0> 2 ** 2 4 irb(main):004:0> 2.0 ** 2 4.0 Does anybody know if this is by design or is simply a consequence of the current implementation? Regards Peter