diff options
| author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2025-12-02 20:41:21 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-02 21:41:21 -0500 |
| commit | 6e723bee45fedaffa5ea382c9ace628b58c0c70d (patch) | |
| tree | 460c626e1e0b59052371210daf992d79af7cda5d /numeric.c | |
| parent | b2f110651c0ab1c3991dd89dc2529a6f21e17170 (diff) | |
[DOC] About Float Imprecision (#15293)
Diffstat (limited to 'numeric.c')
| -rw-r--r-- | numeric.c | 82 |
1 files changed, 0 insertions, 82 deletions
@@ -906,88 +906,6 @@ num_negative_p(VALUE num) return RBOOL(rb_num_negative_int_p(num)); } - -/******************************************************************** - * - * Document-class: Float - * - * A \Float object represents a sometimes-inexact real number using the native - * architecture's double-precision floating point representation. - * - * Floating point has a different arithmetic and is an inexact number. - * So you should know its esoteric system. See following: - * - * - https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html - * - https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rubys-floats-imprecise - * - https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems - * - * You can create a \Float object explicitly with: - * - * - A {floating-point literal}[rdoc-ref:syntax/literals.rdoc@Float+Literals]. - * - * You can convert certain objects to Floats with: - * - * - Method #Float. - * - * == What's Here - * - * First, what's elsewhere. Class \Float: - * - * - Inherits from - * {class Numeric}[rdoc-ref:Numeric@What-27s+Here] - * and {class Object}[rdoc-ref:Object@What-27s+Here]. - * - Includes {module Comparable}[rdoc-ref:Comparable@What-27s+Here]. - * - * Here, class \Float provides methods for: - * - * - {Querying}[rdoc-ref:Float@Querying] - * - {Comparing}[rdoc-ref:Float@Comparing] - * - {Converting}[rdoc-ref:Float@Converting] - * - * === Querying - * - * - #finite?: Returns whether +self+ is finite. - * - #hash: Returns the integer hash code for +self+. - * - #infinite?: Returns whether +self+ is infinite. - * - #nan?: Returns whether +self+ is a NaN (not-a-number). - * - * === Comparing - * - * - #<: Returns whether +self+ is less than the given value. - * - #<=: Returns whether +self+ is less than or equal to the given value. - * - #<=>: Returns a number indicating whether +self+ is less than, equal - * to, or greater than the given value. - * - #== (aliased as #=== and #eql?): Returns whether +self+ is equal to - * the given value. - * - #>: Returns whether +self+ is greater than the given value. - * - #>=: Returns whether +self+ is greater than or equal to the given value. - * - * === Converting - * - * - #% (aliased as #modulo): Returns +self+ modulo the given value. - * - #*: Returns the product of +self+ and the given value. - * - #**: Returns the value of +self+ raised to the power of the given value. - * - #+: Returns the sum of +self+ and the given value. - * - #-: Returns the difference of +self+ and the given value. - * - #/: Returns the quotient of +self+ and the given value. - * - #ceil: Returns the smallest number greater than or equal to +self+. - * - #coerce: Returns a 2-element array containing the given value converted to a \Float - * and +self+ - * - #divmod: Returns a 2-element array containing the quotient and remainder - * results of dividing +self+ by the given value. - * - #fdiv: Returns the \Float result of dividing +self+ by the given value. - * - #floor: Returns the greatest number smaller than or equal to +self+. - * - #next_float: Returns the next-larger representable \Float. - * - #prev_float: Returns the next-smaller representable \Float. - * - #quo: Returns the quotient from dividing +self+ by the given value. - * - #round: Returns +self+ rounded to the nearest value, to a given precision. - * - #to_i (aliased as #to_int): Returns +self+ truncated to an Integer. - * - #to_s (aliased as #inspect): Returns a string containing the place-value - * representation of +self+ in the given radix. - * - #truncate: Returns +self+ truncated to a given precision. - * - */ - VALUE rb_float_new_in_heap(double d) { |
