[ruby-core:81394] [Ruby trunk Bug#13599] Float#ceil(n) doesn't work for small floats

From: david@...
Date: 2017-05-26 14:55:28 UTC
List: ruby-core #81394
Issue #13599 has been reported by Jalada (David Somers).

----------------------------------------
Bug #13599: Float#ceil(n) doesn't work for small floats
https://bugs.ruby-lang.org/issues/13599

* Author: Jalada (David Somers)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.1
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
When using ceil to round up to n digits (as opposed to nearest integer) with the optional first argument, it doesn't work for very small floats:

~~~
2.4.1 :001 > 0.0000000001.ceil(1)
 => 0.0   # => Expected output: 0.1

# Doing it by hand:
2.4.1 :002 > (0.0000000001 * 10).ceil / 10.0
 => 0.1
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next