Issue #8916 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.2: REQUIRED, 2.3: DONE, 2.4: REQUIRED to 2.2: REQUIRED, 2.3: DONE, 2.4: DONE

ruby_2_4 r59299 merged revision(s) 58210.

----------------------------------------
Bug #8916: rb_sprintf 吾膕上墾fhttps://bugs.ruby-lang.org/issues/8916#change-65708

* Author: tadf (tadayoshi funaba)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.1.0dev (2013-09-16 trunk 42949) [i686-linux]
* Backport: 2.2: REQUIRED, 2.3: DONE, 2.4: DONE
----------------------------------------
`rb_sprintf` への精度指定が正しく機能していない。

```c
rb_sprintf("%.04d", -2) /* => "-002" */
```
```ruby
format('%.4d', -2) #=> "-0002"
```



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