Author Topic: problem with real number and nasm.  (Read 16424 times)

stphanef

  • Guest
problem with real number and nasm.
« on: October 04, 2007, 11:07:10 PM »
Hi.

I compiled this code with NASM 0.99.04:

-------------------
       org 0x100                  


section .data

numberA:        dq      1.54
numberB:        dq      2.
numberC:        dq      0.1

section .bss

section .text

start:
        finit
        fld qword [numberA]
        fld qword [numberB]
        fld qword [numberC]
        fld1
        fldpi
        ret
--------------------------------

Then I ran it inside the D86 debugger and I got the followindg FPU stack:

ST0: +3.1415 ..... (as intended)
   ST1: +1.           (as intended)
   ST2: +0.2000...    (2 time numberC)
   ST3: +4.           (2 time numberB)
   ST4: +3.08000...   (2 time numberA)

NASM doubles every value! I did a quick fix so the code would compile with A86:

--------------------------------
        org 100h                  

jmp start
;section .data

numberA:        dq      1.54
numberB:        dq      2.
numberC:        dq      0.1

;section .bss
;section .text

start:
        finit
        fld qword [numberA]
        fld qword [numberB]
        fld qword [numberC]
        fld1
        fldpi
        ret
-----------------------------------

Now the D86 debugger report the FPU stack I expected:

ST0: +3.1415....
  ST1: +1.
  ST2: +0.1000...
  ST3: +2.
  ST4: +1.54000...

Did I do something wrong?

Thank.

sf.

stphanef

  • Guest
Re: problem with real number and nasm.
« Reply #1 on: October 04, 2007, 11:27:36 PM »
sorry to reply to myself.

I recompiled with NASM 0.98.39 and everything is OK.
I suspect a serious bug with NASM 0.99.04.

Thank.

sf.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: problem with real number and nasm.
« Reply #2 on: October 05, 2007, 05:40:04 AM »
I suspect you're correct! :)

We're looking at it. Thanks for the feedback! You'd think someone would have noticed before now, but... I guess we don't do much floating point...

Best,
Frank