Been working on a little calculator project, but the numbers it outputs look kinda messy because Codea calculates so many digits. For example: 1.28547467473725683 As opposed to: 1.28
Is there any way to fix this??
Been working on a little calculator project, but the numbers it outputs look kinda messy because Codea calculates so many digits. For example: 1.28547467473725683 As opposed to: 1.28
Is there any way to fix this??
@DJMoffinz Use the string.format() function. There are a lot of options to it, so do a google search or search the forum for examples. To limit the above large number to the smaller one, it would be something like
function setup()
print(string.format("%.2f",1.28547467473725683))
end
which would print 1.29 rounded up.
Thanks for your help!