ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:71661] [Ruby trunk - Bug #11736] [Open] Float(arg) not consistent with documentation
       [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
@ 2015-11-24 20:10 ` bwheeler96
  2015-12-07  7:43 ` [ruby-core:71889] [Ruby trunk - Bug #11736] " ko1
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: bwheeler96 @ 2015-11-24 20:10 UTC (permalink / raw)
  To: ruby-core

Issue #11736 has been reported by Brian Wheeler.

----------------------------------------
Bug #11736: Float(arg) not consistent with documentation
https://bugs.ruby-lang.org/issues/11736

* Author: Brian Wheeler
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Float(arg) → float
Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. Converting nil generates a TypeError.

Strings are NOT converted using arg.to_f

~~~
'123_INVALID'.to_f 
# => 123.0
~~~

~~~
Float('123_INVALID') 
# => ArgumentError
~~~

This could be fixed by changing object.c like so: 
~~~
-       return DBL2NUM(rb_str_to_dbl(val, TRUE));
+       return DBL2NUM(rb_str_to_dbl(val, FALSE));
~~~

But it appears that this is desired behavior as there are many specs to ensure this strict validity checking. Please update the documentation to reflect this.

Thanks,

Brian




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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:71889] [Ruby trunk - Bug #11736] Float(arg) not consistent with documentation
       [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
  2015-11-24 20:10 ` [ruby-core:71661] [Ruby trunk - Bug #11736] [Open] Float(arg) not consistent with documentation bwheeler96
@ 2015-12-07  7:43 ` ko1
  2016-02-09 17:52 ` [ruby-core:73752] [Ruby trunk Bug#11736] " dpulliam_ruby
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: ko1 @ 2015-12-07  7:43 UTC (permalink / raw)
  To: ruby-core

Issue #11736 has been updated by Koichi Sasada.

Description updated
Assignee set to Zachary Scott

Document is wrong.
Zack, could you fix it?

----------------------------------------
Bug #11736: Float(arg) not consistent with documentation
https://bugs.ruby-lang.org/issues/11736#change-55295

* Author: Brian Wheeler
* Status: Open
* Priority: Normal
* Assignee: Zachary Scott
* ruby -v: 
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Float(arg) → float
Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. Converting nil generates a TypeError.

Strings are NOT converted using arg.to_f

~~~
'123_INVALID'.to_f 
# => 123.0
~~~

~~~
Float('123_INVALID') 
# => ArgumentError
~~~

This could be fixed by changing object.c like so: 

~~~
-       return DBL2NUM(rb_str_to_dbl(val, TRUE));
+       return DBL2NUM(rb_str_to_dbl(val, FALSE));
~~~

But it appears that this is desired behavior as there are many specs to ensure this strict validity checking. Please update the documentation to reflect this.

Thanks,

Brian




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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:73752] [Ruby trunk Bug#11736] Float(arg) not consistent with documentation
       [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
  2015-11-24 20:10 ` [ruby-core:71661] [Ruby trunk - Bug #11736] [Open] Float(arg) not consistent with documentation bwheeler96
  2015-12-07  7:43 ` [ruby-core:71889] [Ruby trunk - Bug #11736] " ko1
@ 2016-02-09 17:52 ` dpulliam_ruby
  2016-10-14  9:29 ` [ruby-core:77628] " hsbt
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: dpulliam_ruby @ 2016-02-09 17:52 UTC (permalink / raw)
  To: ruby-core

Issue #11736 has been updated by dylan pulliam.

File 0001-Improve-documentation-on-Float-Arg.patch added
ruby -v set to ruby 2.1.5p273

I have prepared a patch for this. Let me know what you think.

----------------------------------------
Bug #11736: Float(arg) not consistent with documentation
https://bugs.ruby-lang.org/issues/11736#change-56938

* Author: Brian Wheeler
* Status: Open
* Priority: Normal
* Assignee: Zachary Scott
* ruby -v: ruby 2.1.5p273
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
Float(arg) → float
Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. Converting nil generates a TypeError.

Strings are NOT converted using arg.to_f

~~~
'123_INVALID'.to_f 
# => 123.0
~~~

~~~
Float('123_INVALID') 
# => ArgumentError
~~~

This could be fixed by changing object.c like so: 

~~~
-       return DBL2NUM(rb_str_to_dbl(val, TRUE));
+       return DBL2NUM(rb_str_to_dbl(val, FALSE));
~~~

But it appears that this is desired behavior as there are many specs to ensure this strict validity checking. Please update the documentation to reflect this.

Thanks,

Brian


---Files--------------------------------
0001-Improve-documentation-on-Float-Arg.patch (1.25 KB)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:77628] [Ruby trunk Bug#11736] Float(arg) not consistent with documentation
       [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2016-02-09 17:52 ` [ruby-core:73752] [Ruby trunk Bug#11736] " dpulliam_ruby
@ 2016-10-14  9:29 ` hsbt
  2016-10-27  7:27 ` [ruby-core:77776] " usa
  2016-11-11 16:06 ` [ruby-core:78089] " nagachika00
  5 siblings, 0 replies; 6+ messages in thread
From: hsbt @ 2016-10-14  9:29 UTC (permalink / raw)
  To: ruby-core

Issue #11736 has been updated by Hiroshi SHIBATA.

Assignee changed from Zachary Scott to Hiroshi SHIBATA
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED

----------------------------------------
Bug #11736: Float(arg) not consistent with documentation
https://bugs.ruby-lang.org/issues/11736#change-60898

* Author: Brian Wheeler
* Status: Closed
* Priority: Normal
* Assignee: Hiroshi SHIBATA
* ruby -v: ruby 2.1.5p273
* Backport: 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
Float(arg) → float
Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. Converting nil generates a TypeError.

Strings are NOT converted using arg.to_f

~~~
'123_INVALID'.to_f 
# => 123.0
~~~

~~~
Float('123_INVALID') 
# => ArgumentError
~~~

This could be fixed by changing object.c like so: 

~~~
-       return DBL2NUM(rb_str_to_dbl(val, TRUE));
+       return DBL2NUM(rb_str_to_dbl(val, FALSE));
~~~

But it appears that this is desired behavior as there are many specs to ensure this strict validity checking. Please update the documentation to reflect this.

Thanks,

Brian


---Files--------------------------------
0001-Improve-documentation-on-Float-Arg.patch (1.25 KB)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:77776] [Ruby trunk Bug#11736] Float(arg) not consistent with documentation
       [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2016-10-14  9:29 ` [ruby-core:77628] " hsbt
@ 2016-10-27  7:27 ` usa
  2016-11-11 16:06 ` [ruby-core:78089] " nagachika00
  5 siblings, 0 replies; 6+ messages in thread
From: usa @ 2016-10-27  7:27 UTC (permalink / raw)
  To: ruby-core

Issue #11736 has been updated by Usaku NAKAMURA.

Backport changed from 2.1: UNKNOWN, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: UNKNOWN, 2.2: DONE, 2.3: REQUIRED

ruby_2_2 r56501 merged revision(s) 56421,56422.

----------------------------------------
Bug #11736: Float(arg) not consistent with documentation
https://bugs.ruby-lang.org/issues/11736#change-61080

* Author: Brian Wheeler
* Status: Closed
* Priority: Normal
* Assignee: Hiroshi SHIBATA
* ruby -v: ruby 2.1.5p273
* Backport: 2.1: UNKNOWN, 2.2: DONE, 2.3: REQUIRED
----------------------------------------
Float(arg) → float
Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. Converting nil generates a TypeError.

Strings are NOT converted using arg.to_f

~~~
'123_INVALID'.to_f 
# => 123.0
~~~

~~~
Float('123_INVALID') 
# => ArgumentError
~~~

This could be fixed by changing object.c like so: 

~~~
-       return DBL2NUM(rb_str_to_dbl(val, TRUE));
+       return DBL2NUM(rb_str_to_dbl(val, FALSE));
~~~

But it appears that this is desired behavior as there are many specs to ensure this strict validity checking. Please update the documentation to reflect this.

Thanks,

Brian


---Files--------------------------------
0001-Improve-documentation-on-Float-Arg.patch (1.25 KB)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:78089] [Ruby trunk Bug#11736] Float(arg) not consistent with documentation
       [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2016-10-27  7:27 ` [ruby-core:77776] " usa
@ 2016-11-11 16:06 ` nagachika00
  5 siblings, 0 replies; 6+ messages in thread
From: nagachika00 @ 2016-11-11 16:06 UTC (permalink / raw)
  To: ruby-core

Issue #11736 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.1: UNKNOWN, 2.2: DONE, 2.3: REQUIRED to 2.1: UNKNOWN, 2.2: DONE, 2.3: DONE

ruby_2_3 r56722 merged revision(s) 56421,56422.

----------------------------------------
Bug #11736: Float(arg) not consistent with documentation
https://bugs.ruby-lang.org/issues/11736#change-61445

* Author: Brian Wheeler
* Status: Closed
* Priority: Normal
* Assignee: Hiroshi SHIBATA
* ruby -v: ruby 2.1.5p273
* Backport: 2.1: UNKNOWN, 2.2: DONE, 2.3: DONE
----------------------------------------
Float(arg) → float
Returns arg converted to a float. Numeric types are converted directly, the rest are converted using arg.to_f. Converting nil generates a TypeError.

Strings are NOT converted using arg.to_f

~~~
'123_INVALID'.to_f 
# => 123.0
~~~

~~~
Float('123_INVALID') 
# => ArgumentError
~~~

This could be fixed by changing object.c like so: 

~~~
-       return DBL2NUM(rb_str_to_dbl(val, TRUE));
+       return DBL2NUM(rb_str_to_dbl(val, FALSE));
~~~

But it appears that this is desired behavior as there are many specs to ensure this strict validity checking. Please update the documentation to reflect this.

Thanks,

Brian


---Files--------------------------------
0001-Improve-documentation-on-Float-Arg.patch (1.25 KB)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-11 15:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11736.20151124201015@ruby-lang.org>
2015-11-24 20:10 ` [ruby-core:71661] [Ruby trunk - Bug #11736] [Open] Float(arg) not consistent with documentation bwheeler96
2015-12-07  7:43 ` [ruby-core:71889] [Ruby trunk - Bug #11736] " ko1
2016-02-09 17:52 ` [ruby-core:73752] [Ruby trunk Bug#11736] " dpulliam_ruby
2016-10-14  9:29 ` [ruby-core:77628] " hsbt
2016-10-27  7:27 ` [ruby-core:77776] " usa
2016-11-11 16:06 ` [ruby-core:78089] " nagachika00

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).