Decimal points and rounding input/output
Posted: Wed Dec 14, 2016 10:43 am
Hi
Can anyone help please.
When I run below, it will round to decimal place as per input, however after the the 9th and onwards rounding the output does not follow the same logic for rounding and random numbers start to appear when compared to the original input. What is causing this?
ps. I've added the last print statement so it's easier to compare on the output screen the behaviour of result versus actual
'Decimal points and rounding input/output
y = 123456789.1234567890123456
input "Decimal Points" : dp
a$ = "#.####################"
b$ = left$ (a$,dp + 2)
print "result is. "; b$:y
print "Actuaul input 123456789.1234567890123456"
Or is there a global setting in Smart Basic that controls what I'm trying to achieve
Thank U
Can anyone help please.
When I run below, it will round to decimal place as per input, however after the the 9th and onwards rounding the output does not follow the same logic for rounding and random numbers start to appear when compared to the original input. What is causing this?
ps. I've added the last print statement so it's easier to compare on the output screen the behaviour of result versus actual
'Decimal points and rounding input/output
y = 123456789.1234567890123456
input "Decimal Points" : dp
a$ = "#.####################"
b$ = left$ (a$,dp + 2)
print "result is. "; b$:y
print "Actuaul input 123456789.1234567890123456"
Or is there a global setting in Smart Basic that controls what I'm trying to achieve
Thank U