Project

General

Profile

Actions

Bug #20873

closed

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

Added by nobu (Nobuyoshi Nakada) 18 days ago. Updated 14 days 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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0