summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-11-23 09:45:50 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-11-23 09:45:50 +0900
commitefebbbbf260e8ac5b8efbd0d4336a777cfeac514 (patch)
treed5cda5d6d1b4635f8fd2ffe67f1163f19f774f4a /mrblib
parentf414ed03d6f68330378c688a462b1b9ac10d6e9e (diff)
downloadmruby-efebbbbf260e8ac5b8efbd0d4336a777cfeac514.tar.gz
mruby-efebbbbf260e8ac5b8efbd0d4336a777cfeac514.zip
Implement Float shift methods in C
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/numeric.rb30
1 files changed, 1 insertions, 29 deletions
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb
index 6e4c5027f..17155bfd6 100644
--- a/mrblib/numeric.rb
+++ b/mrblib/numeric.rb
@@ -160,35 +160,7 @@ end
#
# ISO 15.2.9
class Float
- include Integral
# mruby special - since mruby integers may be upgraded to floats,
# floats should be compatible to integers.
- def >> other
- n = self.to_i
- other = other.to_i
- if other < 0
- n << -other
- else
- other.times { n /= 2 }
- if n.abs < 1
- if n >= 0
- 0
- else
- -1
- end
- else
- n.to_i
- end
- end
- end
- def << other
- n = self.to_i
- other = other.to_i
- if other < 0
- n >> -other
- else
- other.times { n *= 2 }
- n
- end
- end
+ include Integral
end