Update explanation of floating point numbers

From @tekwizz123 on github at Proposed PR for floating point explanation on Ruby Assembly Line exercise.

A floating point number has at least one number after the decimal point, not zero or more.

This explanation conflicts with the integers explanation which states its “numbers with no digits behind the decimal separator”.

The proposed patch is:

commit f19d8635eee8b837954b5069bb263a57f9294ff6
Author: Grant Willcox <tekwizz123@users.noreply.github.com>
Date:   Mon Jan 16 13:34:16 2023 -0600

    Update explanation of floating point numbers to explain decimal points better
    
    A floating point number has at least one number after the decimal point, not zero or more.
    
    This explanation conflicts with the integers explanation which states its "numbers with no digits behind the decimal separator".

diff --git a/exercises/concept/assembly-line/.docs/introduction.md b/exercises/concept/assembly-line/.docs/introduction.md
index fd254f5f..5fd0b26f 100644
--- a/exercises/concept/assembly-line/.docs/introduction.md
+++ b/exercises/concept/assembly-line/.docs/introduction.md
@@ -5,7 +5,7 @@
 The two most common types of numbers in Ruby are:
 
 - **Integers:** numbers with no digits behind the decimal separator (whole numbers). Examples are `-6`, `0`, `1`, `25`, `976` and `500000`.
-- **Floating-point numbers:** numbers with zero or more digits behind the decimal separator. Examples are `-2.4`, `0.1`, `3.14`, `16.984025` and `1024.0`.
+- **Floating-point numbers:** numbers with one or more digits behind the decimal separator. Examples are `-2.4`, `0.1`, `3.14`, `16.984025` and `1024.0`.
 
 They are implemented through the `Integer` and `Float` classes.
 

Yep. Feel free to PR :slight_smile:

According to the link, the PR was already there. So I re-opened it, taking some latitude to interpret it a little differently than stated. I hope that is OK.

@kotp Thanks. For PRs that you’re happy are valid and you’re reopening, the discussion can continue on GitHub. There’s no need to fork it here. The aim of having the conversation here is for discussing whether it’s a valid PR (conceptually) in the first place.

So let’s continue the discussion on GH :slight_smile:

Great. As an aside, it did give me a chance to test the link in the “discuss on forums” message that is given when it is initially closed.

Does Ruby not distinguish between 0.0 and 0, like JavaScript?

Playing with a REPL (without any prior experience with Ruby) suggests to me that 1. is valid syntax.

1. is not valid Ruby.

Ruby does distinguish between those two:

1.class
# => Integer

1.0.class
# => Float

puts (1. + 0.5) does work on Repl.it.

As @kotp pointed out on the PR, that’s actually puts (1.+ 0.5) where the . is calling the + method on 1.

1 Like

Fully strict syntax would be (not to mention the “may cause a hard to find bug” space between the parenthesis and method call):

puts(1.+(0.5))