![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,209
Rep Power: 5
![]() |
itoa, ltoa, etc are not standard C or C++. They are (IIRC) extensions supported by some compilers/libraries under windows.
|
|
|
|
|
|
#3 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 3
![]() |
>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. |
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
OK. I thought these were standard functions. But even if these are non-standard extensions, then why not also have ftoa?
Quote:
__________________
PFO - My daily dose of technology. |
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,209
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#6 |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
Thanks grumpy for the insight.
__________________
PFO - My daily dose of technology. |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|