Great Cow Basic uses integer maths. No rounding occurs. 100/7 = 14. Try this in the Windows calculator by selecting the Programmer calculator. The results are the same.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is good to know the following. When completing a division the variable SysCalcTempX will contain the remainder of the division.
Here is an example of using SysCalcTempX.
If OutValueTemp > 0 Or SerPrintVal >= 10 Then
OutValueTemp = SerPrintVal / 10 ' This is the division
SerPrintVal = SysCalcTemp ' Carry over integer.
HSerSend(OutValueTemp + 48)
Wait USART_DELAY
End If
Anobium
Last edit: Anobium 2015-11-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When you divide two numbers in GCB and the result produces a number with a remainder does GCB round up, round down,or truncate the number?
For example:
100/7 = 14.2857. Does GCB give 14 or 15 as the answer?
143 / 57 = 2.508. Do we get 2 or 3?
If it is rounding, at what valuie does change from rounding down to rounding up?
Great Cow Basic uses integer maths. No rounding occurs. 100/7 = 14. Try this in the Windows calculator by selecting the Programmer calculator. The results are the same.
Thanks!
It is good to know the following. When completing a division the variable SysCalcTempX will contain the remainder of the division.
Here is an example of using SysCalcTempX.
Anobium
Last edit: Anobium 2015-11-23