Is there a function in turing that does the opposite of strrealok ?
Author |
Message |
SamF
|
Posted: Tue Jan 05, 2010 9:00 pm Post subject: Is there a function in turing that does the opposite of strrealok ? |
|
|
Is there a function in turing that does the opposite of strrealok ?
Is there a function that checks if a real number can be converted into string without causing an error? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
TheGuardian001
|
Posted: Tue Jan 05, 2010 9:20 pm Post subject: Re: Is there a function in turing that does the opposite of strrealok ? |
|
|
Any real number can be stored in a string, as strings can hold any character. If it's a valid real number, it can safely be converted to a string. |
|
|
|
|
![](images/spacer.gif) |
btiffin
![](http://compsci.ca/v3/uploads/user_avatars/189169540547b535e50e4a7.jpg)
|
Posted: Tue Jan 05, 2010 10:51 pm Post subject: Re: Is there a function in turing that does the opposite of strrealok ? |
|
|
Well, (I'm just being a stickly turd here ... nothing serious)
Plop this 32-bit value in a field and display it as a single precision float.
0 11111111 10000100000000000000000
Spaces for effect, ignore them, seriously. If you are not doing rocket science or financials, this stuff can safely be ignored.
For those that may care, with the spaces; think sign, exponent, fraction, infinity and IEEE-754 quiet and signalling NaN.
I'm going to assume Turing will never allow NaN in a floating point value though, nor would it throw an error on a signalling NaN bit pattern, so again, there are rarely worries and I'm being a weenie even mentioning this.
Cheers |
|
|
|
|
![](images/spacer.gif) |
mirhagk
|
Posted: Wed Jan 06, 2010 7:11 am Post subject: RE:Is there a function in turing that does the opposite of strrealok ? |
|
|
real can always be converted to string, as long as it has something at all in it (even if that something is 0). So just make sure you initialize it before your call to convert it. |
|
|
|
|
![](images/spacer.gif) |
|
|