|
Post by johnno56 on Jun 30, 2021 4:19:25 GMT -6
In some Basic the 'print using()' command can define the way the number is displayed.
I am testing a program, that I found on rosettacode.org, that uses 1,000,000 iterations' RCBasic displays 1,000,000 as 1e+06. Is it possible to format the output to display the proper length of 1e+06 as 1000000?
J
|
|
|
Post by n00b on Jun 30, 2021 11:56:00 GMT -6
I don't really remember scientific notation but if you post your code I might be able to help.
|
|
|
Post by johnno56 on Jun 30, 2021 14:12:31 GMT -6
Ok. I think it is Italian but the results are in English. I was just trying to see what the program was doing.
iteraciones = 1000000 cara = 0 dormir = 0 randomize(timer) for i = 1 to iteraciones - 1 lanza_moneda = rand(2) + 1 dormir = dormir + 1 if lanza_moneda = 1 then cara = cara + 1 else dormir = dormir + 1 end if next print "Wakings over " + str(iteraciones) + " repetitions = " + str(dormir) print "Percentage probability of heads on waking = " + str((cara/dormir*100)) + "%" end
I think it is recording the chances of flipping a coin a million times?
There is no rush on this.... This was only a curiosity...
Many thanks.
J
|
|
|
Post by n00b on Jun 30, 2021 14:21:21 GMT -6
Try using Str_F() instead of Str()
|
|
|
Post by johnno56 on Jun 30, 2021 14:29:55 GMT -6
Wow. That was quick! Thanks for the tip. Will do.
J
|
|
|
Post by johnno56 on Jun 30, 2021 14:33:26 GMT -6
Well that certainly fixed the 'e+06' issue. Cool. I am going to have to remember that command. Many thanks.
J
|
|