diff options
author | Xavier Noria <fxn@hashref.com> | 2010-01-19 22:45:41 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-01-19 22:45:41 +0100 |
commit | 2877e5c216ce40c6ecb75a662fb88b73b698f60e (patch) | |
tree | 55fd393c95708ac7f9f570cb5663dff8ac10615e /railties/guides | |
parent | eaae58ce0c79aa5b4d6de16e2e67034b7fd971bb (diff) | |
download | rails-2877e5c216ce40c6ecb75a662fb88b73b698f60e.tar.gz rails-2877e5c216ce40c6ecb75a662fb88b73b698f60e.tar.bz2 rails-2877e5c216ce40c6ecb75a662fb88b73b698f60e.zip |
AS guide: documents Float#round
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 2a548ac5c2..5dae4ee76d 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -937,7 +937,15 @@ NOTE: Defined in +active_support/core_ext/integer/inflections.rb+. h3. Extensions to +Float+ -... +h4. +round+ + +The builtin method +Float#round+ rounds a float to the nearest integer. Active Support adds an optional parameter to let you specify a precision: + +<ruby> +Math::E.round(4) # => 2.7183 +</ruby> + +NOTE: Defined in +active_support/core_ext/float/rounding.rb+. h3. Extensions to +BigDecimal+ |