NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: nullptr on May 13, 2013, 08:46:01 AM

Title: How to print floating point numbers
Post by: nullptr on May 13, 2013, 08:46:01 AM
Hi all,

How to print floats single and double precission using libc on linux in 64 bit code. could some give some examples.

thanks in advance.
Title: Re: How to print floating point numbers
Post by: Gunner on May 14, 2013, 02:01:37 AM
Try looking at the docs first, try some code, and when stuck, post what you are having trouble with. 

http://www.cplusplus.com/reference/cstdio/fprintf/
http://www.cplusplus.com/reference/cstdio/printf/
Title: Re: How to print floating point numbers
Post by: Gerhard on May 14, 2013, 12:45:39 PM
Hi nullptr,

printing floating point values via libc under 64 bit Linux is little bit tricky. I've attached for you a simple test program and I hope it'll show you the right direction. The tricky part is to ensure the 16 bit alignment of the stack.

Gerhard
Title: Re: How to print floating point numbers
Post by: nullptr on May 14, 2013, 12:59:21 PM
Thanks for replies. I'll follow the links and try the code.