Printing Floating-Point Values

Started by
9 comments, last by L. Spiro 14 years, 1 month ago
momotte, I have actually already finished my implementation using large integers, but it is slow as hell.

My implementation produces output with much greater accuracy than sprintf(), but my timings (in ticks) are more like:
Mine: 960
sprintf: 29

Mine is over 30 times slower!

On the other hand, it is also significantly more accurate.
I can see why your method is so fast, but also less accurate.

I have to decide now which I want more.


Since my large-integer class has all the same operators as a regular integer, I can basically swap my method for yours using a lot of my existing code, then convert to compiler-defined types once it is working.



cache_hit: If you needed to know the reason behind every instance of a wheel being re-invented you would go mad.
Let’s just say that the standard C functions do not work the same on all platforms. Microsoft has extensions that do not exist on Linux/Macintosh, but which I need to use not only on Windows, Linux, and Macintosh, but also on PlayStation 3, Nintendo Wii, Xbox 360, and iPhone/iPod touch.
On the other hand, Macintosh has vsscanf() while Microsoft has nothing. Again, I need vsscanf(), and I need it to work exactly the same on all platforms I am supporting.

_vscprintf() exists on Windows, but only some versions of Windows. And I really need this one.

The list goes on and on.



swiftcoder: Last time I was in a school was when I was teaching C++ and game programming at some university.
Those were the days.

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement