flat assembler
Message board for the users of flat assembler.
Index
> Main > Where to start? Goto page Previous 1, 2, 3, 4, 5, 6, 7 |
Author |
|
revolution 05 May 2012, 12:48
Inagawa wrote: I know, but I am outputting it with wsprintf, which should be able to interpret the format, no? Inagawa wrote: Could you give me one line of code showing how you would output the floating point variable? |
|||
05 May 2012, 12:48 |
|
Inagawa 05 May 2012, 12:51
I see, I forgot I haven't actually asked about outputting 64bit floats, only 64bit. I'll try to figure it out. Thanks for the clue
|
|||
05 May 2012, 12:51 |
|
Inagawa 05 May 2012, 13:16
I've got to ask, what do you mean by "the C formatting library"? I never used C, so if I had to guess, it means a library of a certain implementation of functions like printf, etc.
With that in mind, I have no damn clue as to what's the problem! cinvoke printf, <'%g '>, DWORD[__TimeMicro] prints out 5.40652e-315. But the number already has to be in the right format, since I FSTP-ed it as a float. Is there some formatting function I need to call first? |
|||
05 May 2012, 13:16 |
|
revolution 05 May 2012, 13:20
Inagawa wrote: cinvoke printf, <'%g '>, DWORD[__TimeMicro] prints out 5.40652e-315. But the number already has to be in the right format, since I FSTP-ed it as a float. Is there some formatting function I need to call first? edit to add: Read the spec for the %g format. It expects a qword input. I can tell because it outputted a value that cannot be represented by a single precision float. |
|||
05 May 2012, 13:20 |
|
Inagawa 05 May 2012, 13:24
I already did, it's in the previous posts
Code: __Average dd 0 __Frequency dq 0 __TimeMicro dq 0 __TimeBuffer dq 0 ; ; I have an FPU code like this ; finit fild [__Average] fild [__Frequency] mov DWORD[__TimeMicro], 1000 fild DWORD[__TimeMicro] fdivp fdivp fstp DWORD[__TimeMicro] If I do fstp [__TimeMicro], then it outputs 3.81553e-315 Last edited by Inagawa on 05 May 2012, 13:29; edited 1 time in total |
|||
05 May 2012, 13:24 |
|
revolution 05 May 2012, 13:28
So you divided by zero?
I suggest you start with something simpler: Code: testdp dq 12.34567890 cinvoke someprintfunction, ..., dword[testdp+0], dword[testdp+4], ... |
|||
05 May 2012, 13:28 |
|
Inagawa 05 May 2012, 13:31
Both __Average and __Frequency do have values. The code is too long to show it here. I simply "showcased" the data as being zero initialized. The ST0 at the end of my FPU code does contain a valid value of 11.4. I simply need to store and output it
|
|||
05 May 2012, 13:31 |
|
Inagawa 05 May 2012, 13:35
And oddly enough, when I use this code:
Code: cinvoke printf, <'%f %f'>, DWORD[__TimeMicro], DWORD[__TimeMicro+4] I get an output, which is "11.597398 0.000000". So the float is there, I just have no idea what I'm doing wrong here.. And before you say "Why don't you just do cinvoke printf, <'%f'>, DWORD[__TimeMicro]?" It's because if I do, then I get 0.000000.. |
|||
05 May 2012, 13:35 |
|
revolution 05 May 2012, 14:04
Inagawa wrote: I just have no idea what I'm doing wrong here.. |
|||
05 May 2012, 14:04 |
|
Inagawa 05 May 2012, 14:28
You can see the whole code in the section Macroinstructions -> PerformanceCounter. Please download it and look at what's wrong there
|
|||
05 May 2012, 14:28 |
|
dancho 05 May 2012, 20:01
.data
__TimeMicro dq 11.4 fmt db '%g',0 .code cinvoke printf,fmt,dword[__TimeMicro],dword[__TimeMicro+4] /* stdout */ 11.4 c reference for printf family : http://en.cppreference.com/w/c/io/fprintf |
|||
05 May 2012, 20:01 |
|
Inagawa 05 May 2012, 20:59
I swear on my life that I have tried this EXACT code and it just didn't work. It suddenly works flawlessly now. This makes me doubt my sanity.. Thanks a lot
This is the worst kind of victory though, I don't have the slightest clue how it got fixed... |
|||
05 May 2012, 20:59 |
|
Goto page Previous 1, 2, 3, 4, 5, 6, 7 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.