Showing answer as 0.0 when multiplying 1E-9 by 1000

I am developing an app in which I have a simple multiplication of the number 0.000000001 by 1000. But when I do it it is showing the result as 0.0 instead of 0.000001. Is there any way to prevent this.

image

image

I was further exploring this issue and I noticed same issue for the following numbers also is giving 0.0 as the result-
0.000000001 * 1000 = 0.0 (expected correct result: 0.000001)
0.000000002 * 1000 = 0.0 (expected correct result: 0.000002)
0.000000003 * 1000 = 0.0 (expected correct result: 0.000003)
0.000000004 * 1000 = 0.0 (expected correct result: 0.000004)
0.000000005 * 1000 = 0.0 (expected correct result: 0.000005)

0.000000006 * 1000 = 0.00001 (Looks like the answer is rounded). (expected correct result: 0.000006)
0.000000007 * 1000 = 0.00001 (Looks like the answer is rounded) (expected correct result: 0.000007)
0.000000008 * 1000 = 0.00001 (Looks like the answer is rounded) (expected correct result: 0.000008)
0.000000009 * 1000 = 0.00001 (Looks like the answer is rounded) (expected correct result: 0.000009)

0.00000001 * 1000 = 0.00001 (This result is showing correctly)

use the format as decimal block
http://ai2.appinventor.mit.edu/reference/blocks/math.html#format
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

It is similar to what it is in scratch most likely that the program is reading only a particular amount of digits when not formatted, as @Taifun said, you should use the format as decimal block.

Thank you so much for your immediate respond and helping me out with this issue. I just tried it and its working. :smile:

@Taifun and your explanation is working, thank you so much for your help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.