flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
daluca 30 Jul 2007, 05:58
sorry: I use the 'search' and found the solution in another topic:
it should be defined as qword and passed as 2 dwords to the printf but.... does this mean there is no function to print single-precision numbers? so if I define a float variable in a c program it's really defined as double? I'm confused. |
|||
![]() |
|
Yardman 30 Jul 2007, 06:26
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 02:28; edited 1 time in total |
|||
![]() |
|
vid 30 Jul 2007, 09:20
this really depends on platform. Microsoft libc could treat float as single precision, while glibc could treat it as double precision. You should first find out more about platform whose libc you want to use. And if you want portability, you can't go without at least some "compatiblity layer", like Yardman demonstrated
|
|||
![]() |
|
f0dder 30 Jul 2007, 14:32
The C standard specifies that if you don't have a function prototype or use vararg, char/short are passed as int, and float types are passed as double. Check section 2.7, type conversions.
|
|||
![]() |
|
kohlrak 31 Jul 2007, 00:35
In other words, you can push a 4 byte onto the FPU and pull it, or you can do something else... I forget what it is. I think it was push a 0 befor or after you push the float you want to display.
|
|||
![]() |
|
Yardman 31 Jul 2007, 05:13
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 02:28; edited 1 time in total |
|||
![]() |
|
daluca 31 Jul 2007, 05:32
thanks Yardman I'll use that.
vid: so if I link to msvcrt.dll will I have problems runing my program in different versions of windows? thanks. |
|||
![]() |
|
vid 31 Jul 2007, 10:12
Quote: vid: so if I link to msvcrt.dll will I have problems runing my program in different versions of windows? no, most probably no. But you may have problems if you decide to use another C library, not one from MS. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.