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 11 Sep 2013, 08:55
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 11 Sep 2013, 09:44
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 11 Sep 2013, 10:34
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 11 Sep 2013, 10:43
Post 11 Sep 2013, 10:43
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1617
Location: Toronto, Canada
AsmGuru62 11 Sep 2013, 14:30
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: 1389
Location: Piraeus, Greece
Picnic 11 Sep 2013, 14:57

_________________
Hobby BASIC Interpreter
Post 11 Sep 2013, 14:57
View user's profile Send private message Visit poster's website Reply with quote
randomdude



Joined: 01 Jun 2012
Posts: 83
randomdude 11 Sep 2013, 19:24
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: 1045
Location: Michigan, USA
madmatt 12 Sep 2013, 12:44
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.