Question

I am making a bigger program using Floating-point unitin ASM, but I am getting wrong numbers. I made a simple code, which is also giving false numbers. Anyone got idea why? What is wrong here? I am using ubuntu 32b.

SYSEXIT = 1

.align 32
.data

a: .float 1
b: .float 2
test1: .float 0

.text
.global main

main:

finit 
fld a
fld b

loop:
fmulp
fstp test1

mov $SYSEXIT, %eax
int $0x80

I am using gdb, and after "print a" it shows huge number instead of 1 and the same with other 2 variables (b, test1).

What is wrong here?

Was it helpful?

Solution

You need to use print/f a in order to interpret and print the numbers as floating-point values instead of integers.

Reference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top