flat assembler
Message board for the users of flat assembler.

Index > Main > float (single) to string?

Author
Thread Post new topic Reply to topic
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
i have searched everywhere and the only functions that i could find are for doube precision floats

does anybody know of a single-precision float to string conversion function? Confused
Post 11 Sep 2013, 08:55
View user's profile Send private message Reply with quote
dogman



Joined: 18 Jul 2013
Posts: 114
dogman
What OS? UNIX/Linux must have this...
Post 11 Sep 2013, 09:44
View user's profile Send private message Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
oh... i should have posted this on windows section
Post 11 Sep 2013, 10:34
View user's profile Send private message Reply with quote
dogman



Joined: 18 Jul 2013
Posts: 114
dogman
Post 11 Sep 2013, 10:43
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1398
Location: Toronto, Canada
AsmGuru62
Please take a look at FBSTP instruction here:
http://www.website.masmforum.com/tutorials/fptute/fpuchap6.htm

One of uses of the instruction is to convert FPU data to a text.
I think there is even a code sample in that article.
Post 11 Sep 2013, 14:30
View user's profile Send private message Send e-mail Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1281
Location: countryside
Picnic
Post 11 Sep 2013, 14:57
View user's profile Send private message Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude
thanks guys. il check the links tomorrow
Post 11 Sep 2013, 19:24
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
madmatt
randomdude wrote:
i have searched everywhere and the only functions that i could find are for doube precision floats

does anybody know of a single-precision float to string conversion function? Confused


If your using 'printf' or 'sprintf', etc.
Just 'fst' the float in a dq variable: 'myfloat dq 0.0'
Then use the formatting features to output the precision that you want:
Code:
cinvoke printf, "%4.3f", double [myfloat] ;print to console
cinvoke sprintf, addr stringbuf, "%4.3f", double [myfloat] ;print to a string buffer    

_________________
Gimme a sledge hammer! I'LL FIX IT!
Post 12 Sep 2013, 12:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.