Search code examples
assemblyx86floating-pointexpressiontasm

assembly-time evaluation of floating-point expressions


I am currently familiarizing myself with the possibilities of Turbo Assembler 2.0; I was happy to find out that float constants can be specified as follows.

SomeVariable dd 72.0; corresponds to 042900000h

I was assuming that it is possible to evaluate expressions at assembly-time, like

SomeVariable dd 1.0 / 4.0; does not assemble

however this seems to be impossible. Is there indeed no possiblity to generate constants even from relatively simple expressions at assemble-time?


Solution

  • For FP math, I'm not surprised some (most?) assemblers choose not to do assemble-time eval. That would raise questions like what rounding mode, and what intermediate precision if the expression is more than one operator?

    Most assemblers do integer constant-expressions just fine, including with equ and equivalent foo = 123 named constants.