Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Does anyone know what a floating point number is?

Featured Replies

I finding it difficult to understand a calculation and the tutorial says:

 

'notice the maths seems worng - there are no fractions, only whole numbers. Find out why by researching what a "floating point" number is.'

 

Here is the calculation:

3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6

=7

 

 

and if I write:

3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0

=6.75

 

I have tried to get these answers but I cannot seem to figure it out - any ideas?

Edited by jheg

is there any implied precision in the result field therefore 6.75 is rounded up to be 7?

I finding it difficult to understand a calculation and the tutorial says:

 

'notice the maths seems worng - there are no fractions, only whole numbers. Find out why by researching what a "floating point" number is.'

 

Here is the calculation:

3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6

=7

 

 

and if I write:

3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / 4.0 + 6.0

=6.75

 

I have tried to get these answers but I cannot seem to figure it out - any ideas?

 

Hi there! This is a basic lesson in Algebra which is also my favorite subject.

 

Since this algebra, we have to follow the rules to get the correct answer. In this case, you need to follow EMDAS Rule of Arithmetic Operation (Exponentiation, Multiplication, Division, Addition and Subtraction). Meaning, Division comes first before addition and subtraction comes last.

 

The problem 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 = 7 can be computed by this manner:

(3 + 2 + 1} - 5 + [4 %( (2 - 1) / 4)] + 6 = 7...

 

Now your problem is solved. :hi:

Edited by Afternoon Sun

  • Author

Thanks zed I guessed that was what the difference was but I am struggling to understand the equation here and how is calculated.

 

 

For example:

 

3.0 + 2.0 (=5) + 1.0 (=6)- 5.0 (=1) + 4.0 (=5) % 2.0 (?) - 1.0 / 4.0 + 6.0

 

I'm trying to understand how this calculation is calculated...

  • Author

Hi there! This is a basic lesson in Algebra which is also my favorite subject.

 

Since this algebra, we have to follow the rules to get the correct answer. In this case, you need to follow EMDAS Rule of Arithmetic Operation (Exponentiation, Multiplication, Division, Addition and Subtraction). Meaning, Division comes first before addition and subtraction comes last.

 

The problem 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 = 7 can be computed by this manner:

(3 + 2 + 1} - 5 + [4 %( (2 - 1) / 4)] + 6 = 7...

 

Now your problem is solved. :hi:

 

Thanks AS thats exactly what I was after now I just need to digest it - thanks and +1

  • Author

 

(3 + 2 + 1} - 5 + [4 %( (2 - 1) / 4)] + 6 = 7...

 

 

Can you explain this a bit more..

 

(3 + 2 + 1} (6) - 5 (1) + [4 %( (2 - 1) / 4)] This section is confusing me!! + 6 = 7

 

[4% ((2-1)/4)] - I'm sure its not but to me I'm reading this as 1 divided by 4 times 4% ?

Edited by jheg

Can you explain this a bit more..

 

(3 + 2 + 1} (6) - 5 (1) + [4 %( (2 - 1) / 4)] This section is confusing me!! + 6 = 7

 

[4% ((2-1)/4)] - I'm sure its not but to me I'm reading this as 1 divided by 4 times 4% ?

 

[4 %( (2 - 1) / 4)] This section follows the process:

 

a. 2-1 = 1

b. 1/4 = .25

c. 4%.25 = 0

 

therefore, you have:

6 - 5 + 0 + 6 = 7...

 

By the way the sign % doesn't mean 'percent' but 'modulus'. It is the remainder after division.

Edited by Afternoon Sun

  • Author

[4 %( (2 - 1) / 4)] This section follows the process:

 

a. 2-1 = 1

b. 1/4 = .25

c. 4%.25 = 0

 

therefore, you have:

6 - 5 + 0 + 6 = 7...

 

By the way the sign % doesn't mean 'percent' but 'modulus'. It is the remainder after division.

 

a and b fine I understand but what is the 4 doing to the % and what is that doing with .25 - sorry man I'm struggling to get it :wacko:

a and b fine I understand but what is the 4 doing to the % and what is that doing with .25 - sorry man I'm struggling to get it :wacko:

 

I think you need to do a bit of reading on Mathematical Operators for programming.

 

It's already been pointed out that the '%' is not a percent operator, rather a modulus, meaning it returns the remainder of the equation.

 

For example, 5%2 would return an answer of 1 which is the remainder and NOT 2.5 which is the precise calculation.

Here is the calculation:

3 + 2 + 1=6

6- 5=1

1 + 4=5

5 % 2=1

1 - 1=0

0 / 4=0

0 + 6=6 so the correct answer is 6 not 6.75 nor 7

 

Because % shows the remainder not division or anything else

 

 

and if I write:

3.0 + 2.0 + 1.0 = 6.0

6.0- 5.0= 1.0

1.0 + 4.0=5.0

5.0 % 2.0 = 1.0

1.0- 1.0 = 0

0/ 4.0 = 0

0 + 6.0 =6.0

so the correct answer in both the case is =6.00

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.