Issue #11766 has been updated by Jan Steffens.


Another case:

~~~
"ABC%8.1fDEF" % [1r]
~~~

Expected:

~~~
"ABC     1.0DEF"
~~~

Actual result:

~~~
"ABC     \u0000\u0000\u0000DEF"
~~~

----------------------------------------
Bug #11766: sprintf formatting Rationals as floats produces garbage
https://bugs.ruby-lang.org/issues/11766#change-55212

* Author: Jan Steffens
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Test case:

~~~
"%8.1f %8.1f" % [1r, 1r]
~~~

Expected:

~~~
"     1.0      1.0"
~~~

Actual result:

~~~
"              \u0000\u0000\u0000"
~~~




-- 
https://bugs.ruby-lang.org/