From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 6B48019C02F7 for ; Wed, 25 Nov 2015 04:39:22 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 244DBB5D864 for ; Wed, 25 Nov 2015 05:10:26 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 4379218CC7AF for ; Wed, 25 Nov 2015 05:10:26 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 2A796120489; Wed, 25 Nov 2015 05:10:24 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id 7A48D120465 for ; Wed, 25 Nov 2015 05:10:20 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=Hjzxaf6tofolgGcuOPttzUUqOO8=; b=tivuYzsOEsZSoLNRV5 q/nvuZDUMvUjYmuwoQ0zz4+fjsq+zs8U/SWQNNLIobmxkmjoXtFZgBFmehXmfKyU E2JNYuarqJkhh/fNUDVrMdoG/dJlv/llxicAY5lOCEMtfVEVFBvd5CAKD81Po1Pr uoe2FZha+lDYT159I9nQn5b6Y= Received: by filter0416p1mdw1.sendgrid.net with SMTP id filter0416p1mdw1.4581.5654C42810 2015-11-24 20:10:16.148419026 +0000 UTC Received: from herokuapp.com (ec2-23-22-134-245.compute-1.amazonaws.com [23.22.134.245]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id eCaTCgsZTZ-_8b7YZTby8w for ; Tue, 24 Nov 2015 20:10:15.862 +0000 (UTC) Date: Tue, 24 Nov 2015 20:10:15 +0000 From: bwheeler96@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Redmine-MailingListIntegration-Message-Ids: 46336 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11736 X-Redmine-Issue-Author: bwheeler96 X-Redmine-Sender: bwheeler96 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6SQuXwyuzBDnouc92fNfkJuMJa9RvCek4WQG gAEnm+NqjYFrdUEThbsPjoprIAbN2vYcSVzelwejbtQ80oTMYYIbfqMY+HWrJgoPODx+2Fw9dIf2WD 1+mLJIwZPbCSeSF+Fd6k/KmnWwcknXYDHwyF X-ML-Name: ruby-core X-Mail-Count: 71661 Subject: [ruby-core:71661] [Ruby trunk - Bug #11736] [Open] Float(arg) not consistent with documentation X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "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:=20 * ruby -v:=20 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Float(arg) =E2=86=92 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=20 # =3D> 123.0 ~~~ ~~~ Float('123_INVALID')=20 # =3D> ArgumentError ~~~ This could be fixed by changing object.c like so:=20 ~~~ - 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 ens= ure this strict validity checking. Please update the documentation to refle= ct this. Thanks, Brian --=20 https://bugs.ruby-lang.org/