From 2877e5c216ce40c6ecb75a662fb88b73b698f60e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 19 Jan 2010 22:45:41 +0100 Subject: AS guide: documents Float#round --- railties/guides/source/active_support_core_extensions.textile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') 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: + + +Math::E.round(4) # => 2.7183 + + +NOTE: Defined in +active_support/core_ext/float/rounding.rb+. h3. Extensions to +BigDecimal+ -- cgit v1.2.3