```Issue #5321 has been updated by akr (Akira Tanaka).

I think associating class with exactness is wrong idea.

Please define the exactness of numeric classes, at first.

I think exactness and inexactness is a property of a method, not class.

For example, Integer#+ is exact because it implements mathematical addition exactly (except memory limitation).
Rational#+ is also exact.
As far as I know, BigDecimal#+ also implements mathematical addition exactly.
But Float#+ is inexact because it implements just approximation of mathematical addition.
(So, mathematically invalid result, such as 1.0 + 1e-20 == 1.0, is possible.)

Subtraction and multiplication is same as addition.
(Integer, Rational and BigDecimal are exact but Float is inexact.)

Division is interesting.
Integer#/ is exact as integer division. (But inexact as normal division.)
http://mathworld.wolfram.com/IntegerDivision.html
Rational#/ is exact as normal division.
But Float#/ and BigDecimal#/ is inexact.

I doubt the concept of "exactness of numeric classes".
So, I against this proposal until someone provide a good definition of
exactness of numeric classes.

----------------------------------------
Feature #5321: Introducing Numeric#exact? and Numeric#inexact?
https://bugs.ruby-lang.org/issues/5321#change-83874

* Author: mrkn (Kenta Murata)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
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)

--
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>
```