New lower price for Axon II ($78) and Axon Mote ($58).

0 Members and 1 Guest are viewing this topic.

int integer_divide(int a, int b) { int neg = 1; int ret = 0; if (a < 0) { a = -a; neg = -neg; } if (b < 0) { b = -b; neg = -neg; } while (a >= b) { a -= b; ++ret; } return ret * neg;}

Any mathematical function beyond addition and subtraction must be done with a algorithm using addition and subtraction ONLY,