Project

General

Profile

ActionsLike0

Bug #20873

closed

`printf("%f")` returns wrong result for `Rational` with `FIXNUM_MIN`

Added by nobu (Nobuyoshi Nakada) 5 months ago. Updated 3 months ago.

Status:
Closed
Target version:
-
[ruby-core:119764]

Description

Since the beginning, ruby 2.3.

require 'rbconfig/sizeof'
fmin, fmax = RbConfig::LIMITS.values_at("FIXNUM_MIN", "FIXNUM_MAX")
sprintf("%f", Rational(fmin, fmax)) #=> --1.000000

Added by nobu (Nobuyoshi Nakada) 5 months ago

Revision d71be727

[Bug #20873] Consider -FIXNUM_MIN overflow

-FIXNUM_MIN is usually greater than FIXNUM_MAX on platforms using
two's complement representation.

Added by nagachika (Tomoyuki Chikanaga) 5 months ago

Revision a7b013b3

merge revision(s) d71be7274bd2623bb521be72c245c08fc38d6ae4: [Backport #20873]

    [Bug #20873] Consider `-FIXNUM_MIN` overflow

    `-FIXNUM_MIN` is usually greater than `FIXNUM_MAX` on platforms using
    two's complement representation.

Added by k0kubun (Takashi Kokubun) 3 months ago

Revision 1ec258ab

merge revision(s) d71be7274bd2623bb521be72c245c08fc38d6ae4: [Backport #20873]

    [Bug #20873] Consider `-FIXNUM_MIN` overflow

    `-FIXNUM_MIN` is usually greater than `FIXNUM_MAX` on platforms using
    two's complement representation.
ActionsLike0

Also available in: Atom PDF