flat assembler
Message board for the users of flat assembler.
Index
> Main > doing math on cpu |
Author |
|
nop 04 Jan 2011, 06:51
i dont get it
what do you have against cpu instructions add adc sub sbc mul imul div idiv or fpu instructions fadd etc ??? why do you want to do it the hard way using binary logic ??? |
|||
04 Jan 2011, 06:51 |
|
edfed 04 Jan 2011, 10:12
same quote.
|
|||
04 Jan 2011, 10:12 |
|
bitRAKE 04 Jan 2011, 13:10
The top post should be prefixed with the notion of multi-precision math.
There are some posts on the board regarding the topic. Might want to look into the GMP project. |
|||
04 Jan 2011, 13:10 |
|
b1528932 04 Jan 2011, 18:24
Imul/div/idiv cant be used when my operand is higher than register size.
I want to calculate large nimbers, thousands, hundreds of thousands of bits, by performing multiple operations on them, and i need a template how to design it. Now i got this: - addition, result is also operant one, second operand must be no-greater than first. First operand is overwritten. First operand space must contain additional unit (dword?) to contain carry, although i cant figure out if it wouldnt be better just to indicate carry in other manner. - substraction exactly same as division, although i must check upper boundary when carrying. - multiplication - result is first operand, and its overwritten. Result = size of both operands. third operand might indicate signed or unsigned operation. - division, here i definitly need way of indicateng divide-by-0, first operand is reminder, second must be no-greater in bits than first, third is quotient. fourth operand might be used to indicate divide-by-0, and if i want to perform modulo, division, or both. And possibly signed/unsigned. i addition/substraction i might use 3rd arg to present carry to caller, although i might use extended first operand rule, i havent decided yet. My goal is to make library of functions working on 16, 32 and 64 bit environments, supporting both big and little endian positioning. Those function must be sufficient to perform any mathem,atical task with relative ease, just calling a function with arguments. I want for start to have add/sub/mul/div/idiv/imul, then i will try to make some geometrical functionsa like sinus and tangent. After then, i dont know, what else will be requiret, i appreciate your proposals what to do (anfd maybe how). |
|||
04 Jan 2011, 18:24 |
|
edfed 04 Jan 2011, 20:34
implement just addition and substractions on large number, and after, devellop mul and div on these.
X*Y = X+X+X+ [Y times] X/Y = (X=X-Y) until X lower or equal. first make it work, second, make it work fast. |
|||
04 Jan 2011, 20:34 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.