flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
andyz74 17 May 2011, 07:50
Hmmm..
maybe in this thread : http://board.flatassembler.net/topic.php?t=4377&start=53 is information for me, especially the part "FTOA" ? |
|||
![]() |
|
Endre 17 May 2011, 09:54
Your dilemma: either writing your own libc or using an already existing one. It's up to you.
|
|||
![]() |
|
indinaman 28 Nov 2020, 02:14
;Floating Point Number To String
format PE console 4.0 entry main include '\fasmw16932\fasmw16932\INCLUDE\win32a.inc' section '.data' data readable writeable num1 dq 48.6 num2 dq 17.1 result dq ? fmt db " %.9f",13,10,0 fmt2S db " %s",13,10,0 ;szBuff db 32 dup (0) numS rb 15 section '.code' code readable executable main: fld qword [num1] fld qword [num2] fmulp fstp qword [result] invoke printf, fmt, dword[result] ,dword[result+4] fld qword [num1] fld qword [num2] fdivp fstp qword [result] invoke printf, fmt, dword[result] ,dword[result+4] fld qword [num1] fld qword [num2] faddp fstp qword [result] invoke printf, fmt, dword[result] ,dword[result+4] fld qword [num1] fld qword [num2] fsubp fstp qword [result] invoke printf, fmt, dword[result] ,dword[result+4] invoke _gcvt,dword[result],dword[result+4],15,numS invoke printf, fmt2S,numS ;String Number cinvoke getchar invoke ExitProcess, 0 section '.idata' import data readable library kernel32,'kernel32.dll', msvcrt,'msvcrt.dll' import kernel32, ExitProcess,'ExitProcess' import msvcrt,\ getchar,'getchar',\ atof,'atof',\ strtod,'strtod',\ rand,'rand',\ _gcvt,'_gcvt',\ printf,'printf' |
|||
![]() |
|
Endre 03 Dec 2020, 11:56
Thanks, only one remark: You need to use wine to run this program on Linux. I feel this a bit suboptimal. Could you please provide us a clean Linux version?
|
|||
![]() |
|
Melissa 05 Dec 2020, 04:03
Here is program to print float under Linux.
|
|||||||||||
![]() |
|
Endre 14 Dec 2020, 20:19
Nice, thank you. Did you compare which implementation is faster, yours or that of libc?
|
|||
![]() |
|
Melissa 16 Dec 2020, 02:07
Endre wrote: Nice, thank you. Did you compare which implementation is faster, yours or that of libc? Haven't benchmarked as I don't print floats that much ; ) BTW, implementation is not mine, I took it from somewhere, I guess you can find it perhaps here on forum. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.