How do I specify immediate floating point numbers with inline assembly?

Try something like this

push $0x????????
push $0x????????
fldl (%esp)
addl $8,%esp

Where the ????????'s are replaced by the IEEE representation of the double constant. This method has the advantage that it works equally well in normal and position-independent (PIC, i.e. shared library) code.


I do not know of an assembly language which supports literal floating point constants for immediate use. The usual means is to declare initialized storage containing the floating point constant and referencing it:

const1:     dq  1.2345
...
     fldl    const1

For the example you give, it is possible to do this more directly:

printf ("%f\n", sqrt (150));

Otherwise, this must be an artificially complicated project, perhaps homework.