[General algorithms] custom IEEE-float toString

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

[General algorithms] custom IEEE-float toString

Post by King Harold »

I know you can get decimal digits with log10 tricks, but log10 isn't exactly a fast operation..
Is there any way to make a (formatted) string out of an IEEE float/double without using a log10 trick? If so, how does it work?
(and please don't come up with a C function, I know sprintf would do fine but I really need a general algorithm rather than C-only)
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

The task is anything but simple, so looking into printf might not be a bad idea after all.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

ok, thanx, that is a whole lot more complicated than I thought it to be..
Luckily it's heavily commented :)
.. now to understand it..
Post Reply