flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Plue 27 Feb 2007, 20:20
infinity dd 2139095040
|
|||
![]() |
|
Garthower 27 Feb 2007, 22:00
Plue: Do you can post constants for negative infinity, QNAN and other and for all float types (single, double, extended)? Or, if you can, give me some urls for info about it?
|
|||
![]() |
|
Reverend 27 Feb 2007, 22:22
Code: PRECISION = 32 if PRECISION = 32 PLUS = 0 shl 31 MINUS = 1 shl 31 DENORMALIZED = 1 shl 22 INFINITY = ((1 shl 8) - 1) shl 23 NAN = DENORMALIZED or INFINITY else if PRECISION = 64 PLUS = 0 shl 63 MINUS = 1 shl 63 DENORMALIZED = 1 shl 51 INFINITY = ((1 shl 11) - 1) shl 52 NAN = DENORMALIZED or INFINITY ; else if PRECISION = 80 ; PLUS = 0 shl 79 ; MINUS = 1 shl 79 ; DENORMALIZED = 1 shl 65 ; INFINITY = ((1 shl 15) - 1) shl 66 ; NAN = DENORMALIZED or INFINITY end if denormalized dd DENORMALIZED infinity dd INFINITY or MINUS ; -infinity nan dd NAN ![]() ![]() EDIT: Oh I forgot fasm uses 64-bit numbers so no chance for compiler-time 80 bits INFINITY ot NAN, this one can be only saved during runitme :/. |
|||
![]() |
|
Borsuc 28 Feb 2007, 14:14
Quote: EDIT: Oh I forgot fasm uses 64-bit numbers so no chance for compiler-time 80 bits INFINITY ot NAN, this one can be only saved during runitme :/. |
|||
![]() |
|
vid 28 Feb 2007, 14:32
Code: macro dt [arg] { else equ 1 match =NAN, arg \{ dd ... dd ... dw ... restore else else equ 0 \} match =-=NAN, arg \{ dd ... dd ... dw ... restore else else equ 0 \} ... etc ... match =1, else \{ dt arg \} restore else } that's the idea. Additionaly you can add checking for "+NAN" etc.. |
|||
![]() |
|
LocoDelAssembly 28 Feb 2007, 14:41
Don't forget to define "struc dt ..." also making use of that macro.
|
|||
![]() |
|
Reverend 28 Feb 2007, 17:07
OK, I underestimated fasm's power
![]() |
|||
![]() |
|
Garthower 01 Mar 2007, 08:40
Thanks for info. Using data from Reverend I create constants with db directive. Here they are:
Code: @FcInfinity_Ext: db 7Fh,0FFh,80h,00h,00h,00h,00h,00h,00h,00h ;1.0/0.0 @FcNan_Ext: db 0FFh,0FFh,0C0h,00h,00h,00h,00h,00h,00h,00h ;0.0/0.0 @FcnInfinity_Ext: db 0FFh,0FFh,80h,00h,00h,00h,00h,00h,00h,00h ;-1.0/0.0 @FcInfinity_Double: db 7Fh,0F0h,00h,00h,00h,00h,00h,00h ;1.0/0.0 @FcNan_Double: db 0FFh,0F8h,00h,00h,00h,00h,00h,00h ;0.0/0.0 @FcnInfinity_Double: db 0FFh,0F0h,00h,00h,00h,00h,00h,00h ;-1.0/0.0 @FcInfinity_Single: db 7Fh,80h,00h,00h ;1.0/0.0 @FcNan_Single: db 0FFh,0C0h,00h,00h ;0.0/0.0 @FcnInfinity_Single: db 0FFh,080h,00h,00h ;-1.0/0.0 I hope in future FASM's builds Tomasz will add an opportunity of record of similar numbers without any cunnings. |
|||
![]() |
|
vid 01 Mar 2007, 10:56
Garthower: slightly better version:
Code: label @FcInfinity_Ext tbyte db 7Fh,0FFh,80h,00h,00h,00h,00h,00h,00h,00h ;1.0/0.0 label @FcNan_Ext tbyte db 0FFh,0FFh,0C0h,00h,00h,00h,00h,00h,00h,00h ;0.0/0.0 ... label @FcInfinity_Double qword db 7Fh,0F0h,00h,00h,00h,00h,00h,00h ;1.0/0.0 ... label @FcInfinity_Single dword db 7Fh,80h,00h,00h ;1.0/0.0 ... |
|||
![]() |
|
asmfan 01 Mar 2007, 11:04
By the way? is this correct? Little endian or big?
|
|||
![]() |
|
Garthower 01 Mar 2007, 11:04
Yes, you are right vid. So it will not be need in manual to specify type of data in commands. Thanks!
|
|||
![]() |
|
Garthower 01 Mar 2007, 11:09
asmfan wrote: By the way? is this correct? Little endian or big? Sorry, my english is not so well, but what do you mean in word "endian"? |
|||
![]() |
|
vid 01 Mar 2007, 11:13
endianness means which byte comes first. For example, is 1234ABCDh this:
Code: db 12h, 34h, 0ABh, 0CDh or Code: db 0CDh, 0ABh, 34h, 12h for more info consult wikipedia ![]() |
|||
![]() |
|
Garthower 01 Mar 2007, 11:17
Thanks vid again, I undertood
![]() 2asmfan: Yes, it's a correct constants with currect endian ![]() |
|||
![]() |
|
asmfan 01 Mar 2007, 11:35
Guys, your constants need to be byteswapped to be correct - that's all i meant.
|
|||
![]() |
|
Garthower 01 Mar 2007, 12:30
asmfan wrote: Guys, your constants need to be byteswapped to be correct - that's all i meant. These constants are in Intel format, i.e. in little endian. And you should solve, as to you they should be rearranged. |
|||
![]() |
|
asmfan 01 Mar 2007, 12:40
Les's say no words and run Olly. try to load your constants as if they little endian and you'll see what is correct.
|
|||
![]() |
|
Garthower 01 Mar 2007, 13:14
2asmfan:: Oh, you are right
![]() Here are tested constants with vid recomendation: Code: label @FcInfinity_Ext tbyte db 00h,00h,00h,00h,00h,00h,00h,80h,0FFh,7Fh ;1.0/0.0 label @FcNan_Ext tbyte db 00h,00h,00h,00h,00h,00h,00h,0C0h,0FFh,0FFh ;0.0/0.0 label @FcnInfinity_Ext tbyte db 00h,00h,00h,00h,00h,00h,00h,80h,0FFh,0FFh ;-1.0/0.0 label @FcInfinity_Double qword db 00h,00h,00h,00h,00h,00h,0F0h,7Fh ;1.0/0.0 label @FcNan_Double qword db 00h,00h,00h,00h,00h,00h,0F8h,0FFh ;0.0/0.0 label @FcnInfinity_Double qword db 00h,00h,00h,00h,00h,00h,0F0h,0FFh ;-1.0/0.0 label @FcInfinity_Single dword db 00h,00h,80h,7Fh ;1.0/0.0 label @FcNan_Single dword db 00h,00h,0C0h,0FFh ;0.0/0.0 label @FcnInfinity_Single dword db 00h,00h,080h,0FFh ;-1.0/0.0 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.