Skip to content

Commit

Permalink
Implemented the RDF::Literal::Double#nan?, #finite? and #infinite? me…
Browse files Browse the repository at this point in the history
…thods.
  • Loading branch information
artob committed Aug 24, 2010
1 parent 9b8d761 commit a33a5fd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/rdf/model/literal/double.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,35 @@ def canonicalize
self
end

##
# Returns `true` if the value is an invalid IEEE floating point number.
#
# @return [Boolean]
# @since 0.2.3
def nan?
to_f.nan?
end

##
# Returns `true` if the value is a valid IEEE floating point number (it
# is not infinite, and `nan?` is `false`).
#
# @return [Boolean]
# @since 0.2.3
def finite?
to_f.finite?
end

##
# Returns `nil`, `-1`, or `+1` depending on whether the value is finite,
# `-INF`, or `+INF`.
#
# @return [Integer]
# @since 0.2.3
def infinite?
to_f.infinite?
end

##
# Returns the absolute value of `self`.
#
Expand Down

0 comments on commit a33a5fd

Please sign in to comment.