Skip to content

Commit

Permalink
BigDecimal docs tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija committed Jul 9, 2020
1 parent 9f37a60 commit 8765485
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/big/big_decimal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ struct BigDecimal < Number
# Rounds to the nearest integer (by default), returning the result as a `BigDecimal`.
#
# ```
# BigDecimal.new("3.14159").round # => 3_big_d
# BigDecimal.new("8.7").round # => 9_big_d
# BigDecimal.new("-9.9").round # => -10_big_d
# BigDecimal.new("3.14159").round(2) # => 3.14
# BigDecimal.new("8.7").round # => 9
# BigDecimal.new("-9.9").round # => -10
# ```
#
# If *digits* is specified and positive, the fractional part of the result
Expand Down Expand Up @@ -674,6 +674,7 @@ struct Int
include Comparable(BigDecimal)

# Converts `self` to `BigDecimal`.
#
# ```
# require "big"
# 12123415151254124124.to_big_d
Expand Down Expand Up @@ -710,6 +711,7 @@ struct Float
#
# NOTE: Floats are fundamentally less precise than BigDecimals,
# which makes conversion to them risky.
#
# ```
# require "big"
# 1212341515125412412412421.0.to_big_d
Expand All @@ -734,6 +736,7 @@ end

class String
# Converts `self` to `BigDecimal`.
#
# ```
# require "big"
# "1212341515125412412412421".to_big_d
Expand Down

0 comments on commit 8765485

Please sign in to comment.