Project

General

Profile

Actions

Bug #17114

closed

Float is not properly kept as integer when integer is added without space

Added by tammo (tammo tjarks) over 3 years ago. Updated over 3 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
[ruby-core:99555]

Description

Hello dear ruby community,
I observed the following behaviour:

1.0.floor +1 # => 1.0
(1.0).floor +1 # => 1.0
(1.0.floor) +1 # => 2
1.0.floor + 1 # => 2

I think this is due to +1 being taken as an argument to floor. It is strange that 1.0.floor is an integer but 1.0.floor +1 is a float. Is this intended behaviour? I do not have the latest ruby version installed, so I do not know if it has been changed. I observed it only with +1. With -1, I get:

1.0.floor -1 # => 0

Best regards,
Tammo

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0