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 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Normal
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