flat assembler
Message board for the users of flat assembler.

Index > Main > How create float structure ? Lets say df.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1840
Roman 20 Jan 2019, 09:52
Fasm 1.73 have db, dw, dd ,dq, du
I want create df macro or struct. I'm so tired write after digits '.0'
Code:
df 1,2,3,34,5,26

And we get float 1.0,2.0,3.0,34.0,5.0,26.0
    


How do this ?

And i found interesting code:
Code:
struc dt [arg] {
  if arg eqtype 1.0
    dt arg
  else
    match sign value,arg {
      match =INF,value { dq $8000000000000000 \\}
      match =NaN,value { dq $C000000000000001 \\}
      dw $7FFF - (sign $4000 - $4000) \}
  end if }
    

I think this code write only in macro but not in struct.


Last edited by Roman on 20 Jan 2019, 21:36; edited 1 time in total
Post 20 Jan 2019, 09:52
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 803
Location: Russian Federation, Sochi
ProMiNick 20 Jan 2019, 11:15
Roman, thou found my code.
Code:
struc dt [arg] {
  label . tword ; add this for correcteness
  if arg eqtype 1.0
    dt arg
  else if arg eqtype 1; may be this helps
   dt arg#.0
  else
    match sign value,arg {
      match =INF,value { dq $8000000000000000 \\}
      match =NaN,value { dq $C000000000000001 \\} ; NaN is big range of values, and it is useless in practic (Infinity useless too)
      dw $7FFF - (sign $4000 - $4000) \}
  end if 
  ;if thou define table it is enought, but for single tbyte may be "dw ?" needed for alignment after it
}    


alternative:
Code:
Inf equ -$4000+$4000+$7FFF:$8000000000000000
NaN equ Inf or    

use case
Code:
dt Inf,+Inf,-Inf,+NaN(Index),-NaN(Index); where Index - any value from 1 to $7FFFFFFFFFFFFFFF    


Last edited by ProMiNick on 25 Jan 2019, 08:24; edited 2 times in total
Post 20 Jan 2019, 11:15
View user's profile Send private message Send e-mail Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1840
Roman 20 Jan 2019, 14:03
Yes. I found on site KalibriOS.
ProMiNick did you been on GD.ru ?
Post 20 Jan 2019, 14:03
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 674
l4m2 08 Feb 2019, 04:11
Code:
macro df [x] {
forward
        dq x#.0
}     
Only allow take input integer
Post 08 Feb 2019, 04:11
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.