Project

General

Profile

Actions

Feature #5321

closed

Introducing Numeric#exact? and Numeric#inexact?

Added by mrkn (Kenta Murata) about 13 years ago. Updated almost 5 years ago.

Status:
Rejected
Target version:
-
[ruby-core:39539]

Description

Ruby has several numeric classes such as Integer.
These classes are classified whether their instances represent numbers exactly.
According to this, Integer and Rational are exact, and Float and BigDecimal are inexact because they're always including error.
The exactness of a Complex depends on its real and imaginary parts.

Now, Ruby's numeric classes doesn't provide predicators to investigate the exactness of their instances.
So, if we want to examine whether a number is exactly zero, we must investigate the class of the number.
I want simple way to examine the number exactness.

I propose to introduce Numeric#exact? and/or Numeric#inexact? for resolving this inconvenience.


Files

numeric-exact-5321.patch (7.33 KB) numeric-exact-5321.patch jeremyevans0 (Jeremy Evans), 08/01/2019 12:57 AM

Related issues 2 (0 open2 closed)

Is duplicate of Ruby master - Feature #5520: Numeric#exact?、Numeric#inexact? の追加Rejectedmrkn (Kenta Murata)10/31/2011Actions
Blocks Ruby master - Bug #5179: Complex#rationalize and to_r with approximate zerosClosedmrkn (Kenta Murata)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0