Hello,
Having some trouble with my code. I have a row of numbers, Currently they are 6 decimals long. I want to round them and make them 5 decimal places.
I have been given some psuedo code, but i dont understnad it.
' ! Round data to n decimal points
Function roundValue(Declare value, decimalPlaces)
i = 0
magnitude = 1
FOR i = 0 To decimalPlaces
magnitude = magnitude * 10
END FOR
value = value * magnitude
value = (int,value + 0.5)
value = value / magnitude
return value
END FUNCTION
FOR row = 1 To MAX_ROWS
total = 0.0
FOR col = 1 To MAX_COLS
total = total + rawData(row,col)
END FOR
avg = total / MAX_COLS
rawRowAvg(row) = roundValue(avg, DECIMAL_PLACES)
END FOR
Can anyone point me in the right direction, where to start looking please.
Sorry, i have typed it out wrong, the output i have now is to 6 decimal places, but i want to round up or down the last digit, so its its 111119 i want it to go to 111120, and if its 111111 i want it to go to 111110, do you have a link for that?
Could you show me how to implement it, I have the data already in a row of numbers, can I use what you have put up above to make the current data be rounded and 5 decimal places?