# Character Values Inside of Number Values

• October 1st, 2011, 10:39 PM
bgroenks96
Character Values Inside of Number Values
I am curious... the Java API is able to return the apparent String "NaN" as a double value for non-real calculations.

How can one include characters in a double value?

Say if you wanted to design an implementation of imaginaries in Java, you would need to be able to have "i" in a value, how can you make 2i a valid Number?
• October 2nd, 2011, 11:08 AM
copeg
Re: Character Values Inside of Number Values
NaN is not a string, but a constant double value (read the API on Double for the value). There are many implementations on complex number math - google these terms for the examples.
• October 2nd, 2011, 12:49 PM
bgroenks96
Re: Character Values Inside of Number Values
Quote:

Originally Posted by copeg
NaN is not a string, but a constant double value (read the API on Double for the value). There are many implementations on complex number math - google these terms for the examples.

I have tried using the Double.longBitsToDouble method to convert a character to double but no matter what I pass it, it won't return the character.

I have tried passing the character's bit value and hexadecimal. Both do not return a letter.
• October 2nd, 2011, 01:35 PM
copeg
Re: Character Values Inside of Number Values
Quote:

Originally Posted by bgroenks96
I have tried using the Double.longBitsToDouble method to convert a character to double but no matter what I pass it, it won't return the character.

I have tried passing the character's bit value and hexadecimal. Both do not return a letter.

See the API for double....Double.longBitsToDouble returns a double, not a character.
• October 2nd, 2011, 08:27 PM
bgroenks96
Re: Character Values Inside of Number Values
But the value NaN prints as "NaN"

How can you define something as a double value, when it has a character form in print?