Issue #13833 has been updated by tarotaro0 (kodai nakamura).


Hi, cabo.

I implemented to fix this bug and created PR:

https://github.com/ruby/ruby/pull/1689

Could you please check this?

----------------------------------------
Bug #13833: String#scanf("%a") incorrectly requires a sign on the (binary) exponent
https://bugs.ruby-lang.org/issues/13833#change-66386

* Author: cabo (Carsten Bormann)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
~~~
>> Float("0x1p9")
=> 512.0
>> Float("0x1p+9")
=> 512.0
>> "0x1p+9".scanf("%a")
=> [512.0]
>> "0x1p9".scanf("%a")
=> [0.0]                              # Oops
>> RUBY_VERSION
=> "2.4.1"
~~~

In scanf.rb, there are three regexps that say the equivalent of [pP][+-] where they should say [pP][+-]?



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>