Discussion:
print floating point numbers
(too old to reply)
Ivan Kossey
2010-04-03 09:24:20 UTC
Permalink
Hi Gurus!

I printed integers with format string (like "%6d ") without any problem. But
how to print floating point numbers?
I have to print a 4-byte number. What push into stack? Should I push the
address of number? What is with length of number (4, 8 or 10 bytes)?

The format string I use is following:

db "%6.1f ",0

Thanks

Happy Easter!
Tim Roberts
2010-04-04 04:39:58 UTC
Permalink
Post by Ivan Kossey
I printed integers with format string (like "%6d ") without any problem. But
how to print floating point numbers?
I have to print a 4-byte number. What push into stack? Should I push the
address of number? What is with length of number (4, 8 or 10 bytes)?
db "%6.1f ",0
You should mention that you are calling "printf". That's critically
important to your question.

All of the floating formats in printf require an 8-byte double. If you
have a 4-byte single, you'll need to convert it to a double and push those
8 bytes.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
123
2010-05-05 00:32:20 UTC
Permalink
123
Post by Ivan Kossey
Hi Gurus!
I printed integers with format string (like "%6d ") without any problem.
But how to print floating point numbers?
I have to print a 4-byte number. What push into stack? Should I push the
address of number? What is with length of number (4, 8 or 10 bytes)?
db "%6.1f ",0
Thanks
Happy Easter!
Loading...