From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id E4E4A1F66E for ; Tue, 11 Aug 2020 14:38:48 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 21BBD1209DB; Tue, 11 Aug 2020 23:38:16 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id D2ADF1209DA for ; Tue, 11 Aug 2020 23:38:13 +0900 (JST) Received: by filterdrecv-p3mdw1-7ff865655c-s2b8s with SMTP id filterdrecv-p3mdw1-7ff865655c-s2b8s-17-5F32AD71-5C 2020-08-11 14:38:41.95144099 +0000 UTC m=+1110147.124724096 Received: from herokuapp.com (unknown) by ismtpd0102p1mdw1.sendgrid.net (SG) with ESMTP id dPcGdY2vS62_1uZ_sK_ing for ; Tue, 11 Aug 2020 14:38:41.838 +0000 (UTC) Date: Tue, 11 Aug 2020 14:38:42 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75381 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17114 X-Redmine-Issue-Author: tammo X-Redmine-Sender: jeremyevans0 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: =?us-ascii?Q?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BI4im0hPm3SDrKU9KMhba0Ng+fRd37d7qsKhjrq?= =?us-ascii?Q?Fd2sdZQ6Qo8XCVcxeEK+6gMVX3Nt6j=2Fut3OiS2B?= =?us-ascii?Q?1AS2bOmaru1LRQjVLEsxdbH=2FR2a4YRbrnl7ciAc?= =?us-ascii?Q?jWGDtolQvsHYwQ=2FgHAV0NQ3MXLHb1t160fX8V6I?= =?us-ascii?Q?105l1hy5ScAFNP44w=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99556 Subject: [ruby-core:99556] [Ruby master Bug#17114] Float is not properly kept as integer when integer is added without space 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17114 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected This is expected. `1.0.floor + 1` is parsed as `((1.0).floor).+(1)`. `1.0.floor +1` is parsed as `(1.0).floor(+1)`. This is also true for `-1`, it's just that `((1.0).floor).-(1)` and `(1.0).floor(-1)` are both `0`, since `(floor).floor(-1)` means the floor of the 10s column. You'll get different results for `10.0.floor -1` and `10.0.floor - 1`. ---------------------------------------- Bug #17114: Float is not properly kept as integer when integer is added without space https://bugs.ruby-lang.org/issues/17114#change-87016 * Author: tammo (tammo tjarks) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Hello dear ruby community, I observed the following strange behaviour (maybe it is intended) in Version 2.6.3p62: ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] In pry I can see: ``` ruby [7] pry(main)> 1.0.floor +1 => 1.0 [8] pry(main)> (1.0).floor +1 => 1.0 [9] pry(main)> (1.0.floor) +1 => 2 [10] pry(main)> 1.0.floor + 1 => 2 ``` I think the reason is, that +1 is taken as argument to floor. Anyway, it is strange, that 1.0.floor is integer but 1.0.floor +1 again a float. Is this intended behaviour. I have not the lates ruby version installed, so I do not know if it may be changed. Also I observed it only with +1. With -1 I get: ``` ruby [8] pry(main)> 1.0.floor -1 => 0 ``` Best regards, Tammo -- https://bugs.ruby-lang.org/