Skip to content
Snippets Groups Projects
Commit 58d610e1 authored by THIRIOUX Xavier's avatar THIRIOUX Xavier
Browse files

corrected the division conversion scheme

parent 8cc55e2c
No related branches found
No related tags found
No related merge requests found
......@@ -33,13 +33,7 @@ a div_M b = (a - (a mod_M b)) div_C b
* From Euclidian to C
a mod_C b = (a >= 0 ? a mod_M b : - ((-a) mod_M b))
(using math def to ensure positiveness of remainder))
= (a mod_M b) - (a mod_C < 0 ? abs(b) : 0)
= a mod_M b - ((a mod_M b <> 0 && a <= 0) ? abs(b) : 0)
(using the def of mod_M above)
a mod_C b = a mod_M b - ((a mod_M b <> 0 && a <= 0) ? abs(b) : 0)
a div_C b = (a - (a mod_C b)) div_M b
Let's choose the second, simpler, def of mod_C
= (a mod_M b <> 0 && a <= 0)?((a - a mod_M b + abs(b)) div_M b) :((a - a mod_M b) div_M b)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment