Measuring decimal places
-
How do you measure how far the decimal place is? (e.g. tenth, hundredth, thousandth place)
-
Can you explain the question with an example? It’s not clear what you are trying to measure.
-
Like if you want to find this decimal (in bold): 0.0001
-
You can ask XO about it. Here is an example prompt:
write a program to find out the third digit after the decimal point for a number
-
@The_True_Odst I struggled to understand what you meant at first, but after some re-reading, I can help. So I understand you want to be able to find the decimal number AT any decimal place of any decimal number reliably.
So, decimal places go like
0.0001
(whole number).tenths,hundredths,thousandths,ten-thousandths, hundred-thousandths, millions, etc.So we know the bold in 0.0001 is thousandths, but we need a program to do that.
We’ll just be saying the number of its place instead, like that’s the third decimal place here (3).So we need to clean up the number by making it positive (incase its negative), and only focusing on the part after the decimal point, then returning the decimal place based on another input.
Make a reporter custom block with two inputs then put this code into it:
It should report the number that exists at a decimal place. So in 0.128456, if you wanted to know the number that resides at thousandths place (3), then you’d do (return decimal place (3) of decimal number (0.128456)) and it would report “8”.