NASM Forum > Programming with NASM

Using idiv

<< < (2/3) > >>

Frank Kotler:
Hi JohnG,
"other changes"? Just remove the square brackets from r8.
 
I do not get that error.

I think if you post a few more times, the  Forum will believe you are human.. Sorry 'bout that.

Best.
Frank



JohnG:
Hi all,

Yes Frank the Forum says I am human now, that could be argued by many though.

I put the x64dbg on it and it does seem to be dividing ok, some issue with the printf, which was working but not now, go figure.

Frank Kotler:
Good there is some progress with the forum, anyway.

I haven't run Windows since win98 was current. 32 bit code was similar Linux and Windows. 64 bit code not so! I can't help you much.

Code examples are always welcome!

Best,
Frank

JohnG:
Hi all,

ok, got the little test program running again.

Back to the idiv.   I see you get a quotient and a remainder  but what if you want to know the decimal part.

as in   155/4 = 38.75    what I get is  38 in rax,  3 in rdx   which is  0.75 ie 3/4


John

Frank Kotler:
Oh my!

As the name suggests, idiv is integer division. You want floating point.

In the good old days, the floating point unit, if you had one, would do this with "fdiv", Gettin the number tp/from float to ascii was the tricky part.

Nowadays, it's done with xmm or mmx - I'm not even sure which. Way above my pay grade.

Good luck!

Best,
Frank

?
Section A.4.60: DIVPD: Packed Double-Precision FP Divide
?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version