Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 30th, 2006, 8:17 AM   #1
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
Why there is no ftoa?

I can't seem to find it in the standard C/C++ library. There are itoa, ltoa, ultoa but no ftoa?
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Apr 30th, 2006, 8:22 AM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,209
Rep Power: 5 grumpy is on a distinguished road
itoa, ltoa, etc are not standard C or C++. They are (IIRC) extensions supported by some compilers/libraries under windows.
grumpy is offline   Reply With Quote
Old Apr 30th, 2006, 8:32 AM   #3
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 3 Narue is on a distinguished road
>I can't seem to find it in the standard C/C++ library.
Probably because it's not there. sprintf is a suitable alternative.

>There are itoa, ltoa, ultoa
Try reading the standard documentation instead of looking at your header files or compiler documentation. Those three functions are non-standard extensions provided by your compiler.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote
Old Apr 30th, 2006, 11:56 AM   #4
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
OK. I thought these were standard functions. But even if these are non-standard extensions, then why not also have ftoa?
Quote:
Originally Posted by narue
sprintf is a suitable alternative.
Yeah, I know but was just wondering about ftoa.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Apr 30th, 2006, 10:32 PM   #5
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,209
Rep Power: 5 grumpy is on a distinguished road
One of the most common reasons for non-standard extensions is that the team implementing the compiler (or even the OS) find them convenient. Such people very rarely do anything with floating point......

Look at the fact that most mainstream programming languages do not support floating point all that well (in the case of C, anything to do with floating point was actually an after-thought after the "necessary" language features were specified). The reason is that very few people who develop compilers EVER do serious work with floating point and therefore consider it unimportant. That's one reason that IEEE floating point formats are so common: not because they're superior to other floating point formats, but because the compiler vendors do not have to work hard to come up with a useful specification. The vendors who have devoted a lot of attention to floating point (particularly optimisation of code that uses floating point) are usually the ones who have been given a hard time by paying customers rather than it being something they do of their own initiative.
grumpy is offline   Reply With Quote
Old May 1st, 2006, 10:23 AM   #6
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
Thanks grumpy for the insight.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old May 3rd, 2006, 7:45 AM   #7
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
You have move into the Cray world or other parallel processing arenas to see better FP. FORTRAN is also one place where folks demand extended precision, like 256 bit reals, and complex arithmetic operations - like were added (as an afterthought) to the C99 standard.

The flip side of this is that most people writing C have little idea what nan, inf, or fpclassify are all about unless they have a decent math/CS background.
jim mcnamara is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:46 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC