Skip to content

Commit

Permalink
Clarify behaviour of unsafe Float-to-number conversions (#10631)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil authored Jun 13, 2021
1 parent e49bd98 commit f866a5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/primitives.cr
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ end
end

# Returns `self` converted to `{{type}}`.
# In case of overflow a wrapping is performed.
# In case of overflow
# {% if ints.includes?(num) %} a wrapping is performed.
# {% elsif type < Int %} the result is undefined.
# {% else %} infinity is returned.
# {% end %}
@[Primitive(:unchecked_convert)]
def {{name.id}}! : {{type}}
end
Expand Down

0 comments on commit f866a5a

Please sign in to comment.