Project

General

Profile

Actions

Bug #10151

closed

Weird result when % formatting a Rational value

Added by matsuda (Akira Matsuda) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]
[ruby-core:64454]

Description

Getting a strange output when formatting a Rational value in trunk.

% ruby -v -e 'p "%.1f" % 1.2r'
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
"1.2"

% ruby -v -e 'p "%.1f" % 1.2r'
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]
"6.0"

In this case 1.2r inspects into 6/5 and then the % takes its first letter, I guess?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0