flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
mns
hello,i'm trying learn addition of 2 floating point numbers with the code(attached) bellow.when adding same numbers two times they give different results(well results are in other way round and it is not the problem)
can someone please explain me why two results (addition1 and addition2 in the code)for same numbers? ![]()
|
|||||||||||
![]() |
|
mns
Thank you very much
please can you explain more? I thought with loop of stosb will make a string(text buffer) for 32times which starting from num1 or num2 and add 24h to the end of it with last stosb. |
|||
![]() |
|
mns
by the way your solution worked like a charm.thanks again
|
|||
![]() |
|
Trinitek
The problem is that you made your text buffers only one byte large. The first binary value that is printed out is correct, but when you created the string in buffer num1, you ended up overwriting the floating point constants. Therefore, the second time you tried to add the numbers together, float4 and float5 weren't equal to 9.45 and 5.22 anymore. They were destroyed.
If you had put your float constants before your text buffers, it would've worked correctly as well. Or... you could expand num1 and num2 to cover 33 bytes each, like I suggested above. |
|||
![]() |
|
mns
many many thanks Trinitek.
![]() ![]() |
|||
![]() |
|
Trinitek
No problem!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.