How to represent floating point numbers with German format

How to represent floating point numbers with German format

Post by Stefan Kraus » Wed, 28 Jun 2000 04:00:00



Hallo,
I want to represent floating point numbers in German format, i.e.:
3,1415 instead of 3.1415. To do so I use the method
setlocale(LC_NUMERIC, "GERMAN"), which is provided by the header file
locale.h. This works pretty well with my C++ Compiler under Linux, but
does not work at all with the Compiler of SUN OS 5.6.
So I want to know if there is a way to set locales with the SUN OS
compiler. May be that I used something deprecated or that there is a
better way to set locales or that my syntax was not correct.
To circumvent the problem I tried something like this:
        ostrstream os;
        double floatingPoinNumber = 6.45;
        string floatingPoinNumberAsString;

        os << floatingPoinNumber;
        floatingPoinNumberAsString = os.str();
        floatingPoinNumberAsString.replace(timeStr.find("."), 1, ",");
        cout << floatingPoinNumberAsString << endl;
So if somebody could tell me how I can clear my stream in the way that I
erase the inserted and converted number and can reuse the stream, this
would help me also. Unfortunately I have to use this stream stuff,
because sstream does not exist on SUN OS 5.6.

Thx Stefan

 
 
 

1. Q: floating point format details

I'm writing a function to convert VAX floating point (in binary)
PC (Linux) float.  I know there's a lot of expertise here on
PC floats, so I decided to ask here about a couple of details.

On the VAX a float with a sign and (biased) exponent of 0 is
taken to be 0.0, no matter what the fraction contains.  Is that
also true of the PC?

On the VAX a float with sign = 1 and (biased) exponent = 0
is an invalid float (NaN).  Is that also true of the PC?

I have some early Intel documentation on the 8087 which says
the exponent bias is 127.  This sounds right but I have some
doubts.  Could someone confirm/deny this?

jim mullens


2. squid process

3. IEEE Floating point format

4. ram, mixing and matching ?

5. Need floating point format for AT&T pc.

6. Stop others from using your computer!!! 6635

7. VAX floating point format conversion

8. Debian Printer Install

9. floating point formats

10. Sparc10 floating point format?

11. Floating point format for Intel math coprocessors

12. format of floating points?

13. Question on floating-point numbers