Created
October 5, 2009 10:50
-
-
Save kakutani/202048 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -v -rbigdecimal -e '%w[Infinity NaN].each{|s| v = BigDecimal.new(s); i = v.to_i rescue $!.class; print "#{v}: ";p i}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /usr/bin/ruby -v -rbigdecimal -e '%w[Infinity NaN].each{|s| v = BigDecimal.new(s); i = v.to_i rescue $!.class; print "#{v}:";p i}' | |
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0] | |
Infinity:nil | |
NaN:nil | |
$ ruby -v -rbigdecimal -e '%w[Infinity NaN].each{|s| v = BigDecimal.new(s); i = v.to_i rescue $!.class; print "#{v}:";p i}' | |
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9] | |
Infinity:FloatDomainError | |
NaN:FloatDomainError | |
$ ruby19 -v -rbigdecimal -e '%w[Infinity NaN].each{|s| v = BigDecimal.new(s); i = v.to_i rescue $!.class; print "#{v}:";p i}' | |
ruby 1.9.2dev (2009-10-05 trunk 25235) [i386-darwin9.8.0] | |
Infinity:FloatDomainError | |
NaN:FloatDomainError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment