Can someone explain floating point?

Can someone explain floating point?
0

#1

i need help understanding the floating point?

#2

It just means decimal point doesn’t it?

#3

i need help creating a decimal number? i looked it goes from 1 to 9 but i need it explain a little more

#4

Hey @chaz899 a decimal is a way of writing a number that is not whole. Decimal numbers are ‘in-between’ numbers. For example, 5.25 is in between the numbers 5 and 6. It is more than 5, but less than 6. There is no limit to how big they are for example 9999.5 and 9.55566677 are both valid. Floating points are basically exactly the same as decimals.

#5

thank you for explaining it to me.

whats wrong with my code cmwebby

var ourDecimal = 5.7;

// Only change code below this line

var ourDecimal = 5.7;

ourDecimal.toFixed(2);

#6

Hey @chaz899 can I ask what you’re trying to achieve? The first thing i’ve noticed is that you declare ourDecimal twice - is that something to do with it?

#7

@cmwebby im trying to get past Create Decimal Numbers with JavaScript, i dont know why its not working

#8

Right okay. These are the instructions “Create a variable myDecimal and give it a decimal value with a fractional part (e.g. 5.7).” .

Bascially it is asking you to create a variable called myDecimal which you assign a floating point number to. You were almost there.

You don’t need the toFixed() method line and instead of creating the second ourDecmial variable you can change it to myDecimal. (You only declare a variable with var/let/const once).

Hopefully that helps?

#9

Hi,

Re-read the instructions until you fully understand them (just the bit under the heading instructions) and you might see your error.

JavaScript can be very confusing at first so I found in the beginning that taking time to really really understand what was being asked by breaking the instructions down line by line and also reading the expected outcomes / tests at the bottom really helped me through.

Cheers

Mark

#10

thank you for explaining, i will listen to both of you

#11

Agree so much with this. I find it so much easier knowing what I’m expected to output.