-1

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?

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180
  • Does gdb know that you're asking it to print floating point numbers and not integers? I think it may not know that. And 1.0 and 2.0 are indeed huge numbers if you interpret their 32 bits as 32 bits of an integer. – Alexey Frunze Apr 20 '13 at 10:22

1 Answers1

0

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

Reference.

Alexey Frunze
  • 61,140
  • 12
  • 83
  • 180