11-28-2022, 10:33 PM
Fixed.
Code: (Select All)
$Console:Only
Print "Equation Steve's Results | Pete's Results"
Print
For i = 10 To -10 Step -1 ' Modulo 5
Print i; "mod 5 =";: Locate , 18: Print Steve_ModX(i, 5), , Pete_modx(i, 5)
Next
Print "----------------------Negative Mods----------------------"
For i = 10 To -10 Step -1 ' Modulo -5
Print i; "mod -5 =";: Locate , 18: Print Steve_ModX(i, -5), , Pete_modx(i, -5)
Next
Function Pete_modx (i, j)
Pete_modx = (Abs(i) - Abs(j) * ((Abs(i) \ Abs(j)) + (1 - Sgn(i)) \ 2)) * Sgn(i Mod j)
End Function
Function Steve_ModX (num1, num2)
Steve_ModX = ((num1 Mod num2) + Abs(num2)) Mod num2
End Function