Created
March 18, 2009 00:32
-
-
Save igal/80856 to your computer and use it in GitHub Desktop.
Diophanties if 1/2 were integer
This file contains 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
# @MarkusQ ~Diophantines would be easier if 1/2 were an integer~ | |
class Float | |
def kind_of_with_easier_diophantines?(klass) | |
return self == 0.5 && klass == Integer || kind_of_without_easier_diophantines?(klass) | |
end | |
alias kind_of_without_easier_diophantines? kind_of? | |
alias kind_of? kind_of_with_easier_diophantines? | |
end | |
=begin | |
(0.5).kind_of?(Integer) # => true | |
(0.6).kind_of?(Integer) # => false | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment