flat assembler
Message board for the users of flat assembler.

Index > Main > Something doen't work

Author
Thread Post new topic Reply to topic
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng
Code:
PI = 3.1415926
kx =  PI/320
c1 dd kx
c2 dd PI/200     
    
Post 06 Apr 2004, 08:13
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7752
Location: Kraków, Poland
Tomasz Grysztar
When you define numerical constant without size operator, fasm by default defines 64-bit value, so:
Code:
PI = 3.1415926    

defined constant PI with 64-bit value, which is then treated as a 64-bit binary data, and other calculations are done on the integer interpretation of it.
To define constant with 32-bit FP representation of 3.1415916, you should use:
Code:
PI = dword 3.1415926    

But remember that all arithmetical calculations in fasm are the integer operations.
Post 06 Apr 2004, 09:48
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.