The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: rags on September 23, 2005, 02:44:27 PM

Title: FP constants
Post by: rags on September 23, 2005, 02:44:27 PM
I decided to try to lean a little about fpu math, and started to read Raymonds tutorial on the fpu.

what I didn't see and I am having problems with, is declaring a FP constant in the .data section.

For example:
  when I try this:


.data
var1 dq .3048


  I get this:
    error a2006
   undefined symbol: 3048

How would I declare a fp constant, without having it as a string first such as:


.data
var1 db ".3048",0


and convert it to an integer using the FPULib function FpuAtoFl ?
Title: Re: FP constants
Post by: dsouza123 on September 23, 2005, 02:54:21 PM
.data
var1  real8   0.3048
var2  real10 1.2342

real8 is floating point equivalent of qword, dq  (eight bytes)
real10 is floating point equivalent of tbyte, dt  (ten bytes)
Title: Re: FP constants
Post by: rags on September 23, 2005, 06:18:27 PM
Thank you! :U
Title: Re: FP constants
Post by: raymond on September 24, 2005, 03:20:03 AM
rags

You can always use dd for a REAL4, dq for a REAL8, and dt for a REAL10. However, the MASM assembler NEEDS both an integer portion (even if it's 0), a decimal point, AND at least one decimal digit (again even if it's 0) in order to convert the declared value as a float.

(I don't know how other assemblers deal with the syntax of those declarations.)

Raymond