Home > Blockchain >  Is it possible to define a floating point constant (`equ`) in NASM?
Is it possible to define a floating point constant (`equ`) in NASM?

Time:10-16

In NASM, it's possible to define integer constants (equ), however, doing the same with floating point values causes an error:

section .data
    c1 equ 3       ; ok
    v2 dq  3.14    ; ok
    c2 equ 3.14    ; not ok: `my.asm:7: error: expression syntax error`

is it possible to define a floating point constant?

I've check the manual, but there's very little information.

CodePudding user response:

No, equ doesn't work with non-integers. As fuz put it nicely:

The equ directive defines symbols. The value of a symbol is an address or an integer of the same size as an address.

Instead, you could use

  • Related