flat assembler
Message board for the users of flat assembler.
Index
> Main > Why Fasm don`t add float numbers ? |
Author |
|
revolution 29 Aug 2020, 08:43
What happens if you try this?
Code: x = 4.2 y = 3.6 dd x ; error: value out of range. dd y ; error: value out of range. dd x+y ; error: value out of range. dq x+y ; okay. But what value is stored? |
|||
29 Aug 2020, 08:43 |
|
Roman 29 Aug 2020, 08:52
I do this:
Code: x = 0.5f z = 0.5f Floats dq x,z,x+z,0,0 IDA Pro show this: Floats: dd 0,3FE00000h dd 0,3FE00000h dd 0,7FC00000h dd 4 dup(0) |
|||
29 Aug 2020, 08:52 |
|
revolution 29 Aug 2020, 08:56
Do you know how the float format is stored?
|
|||
29 Aug 2020, 08:56 |
|
Roman 29 Aug 2020, 08:58
|
|||
29 Aug 2020, 08:58 |
|
revolution 29 Aug 2020, 09:05
fasm doesn't have a float computation engine. So any arithmetic you try will come out wrong. See my example above. If you add 4.2 and 3.6 you get -4.116386638238323e-308
|
|||
29 Aug 2020, 09:05 |
|
Roman 29 Aug 2020, 09:05
Quote:
Do you remember rept trick converted to float ? rept 2 m:1 {dd -m\#.8 } |
|||
29 Aug 2020, 09:05 |
|
Roman 29 Aug 2020, 09:07
Quote:
If convert text to float use sse(calculate 4.2+3.6) and convert result to text ? Last edited by Roman on 29 Aug 2020, 09:10; edited 2 times in total |
|||
29 Aug 2020, 09:07 |
|
revolution 29 Aug 2020, 09:07
fasm can convert text into floats. fasm can't then add those floats together because the format isn't a simple integer.
|
|||
29 Aug 2020, 09:07 |
|
revolution 29 Aug 2020, 09:08
Roman wrote: If convert to float use sse(4.2+3.6) and convert to text ? |
|||
29 Aug 2020, 09:08 |
|
Roman 29 Aug 2020, 09:11
This is another reason keep write my fasm++
Quote: fasm only uses 386 opcodes. SSE isn't available. How about fasmg ? |
|||
29 Aug 2020, 09:11 |
|
Tomasz Grysztar 29 Aug 2020, 10:53
Roman wrote: How about fasmg ? Code: include 'cpu/p6.inc' use32 mov dword [edx],11.6+5.6 |
|||
29 Aug 2020, 10:53 |
|
Overclick 06 Sep 2020, 23:45
Tomasz, why doesn't it updated yet for few already old generations? Does some one still use 386-processors?
|
|||
06 Sep 2020, 23:45 |
|
bitRAKE 07 Sep 2020, 03:57
There are x86 embedded systems that are 386, IIRC.
Newer instructions don't inherently provide a benefit. |
|||
07 Sep 2020, 03:57 |
|
Overclick 07 Sep 2020, 08:05
bitRAKE, 387,mmx,sse? Isn't it better to deal with float numbers?
|
|||
07 Sep 2020, 08:05 |
|
revolution 07 Sep 2020, 08:07
Overclick wrote: ... 387,mmx,sse? Isn't it better to deal with float numbers? |
|||
07 Sep 2020, 08:07 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.