That's a bit difficult to write in an easy-to-understand title...
When I run float.Parse()
on "12E2"
or "12e2"
it returns 1200
(12*10^2
) rather than 144
(12^2
). This happens with any number, not just this one case.
Edit: Yes, I know 12E2 is not supposed to give 12^2. I’m asking how you are meant to do it.
What notation would be required to have it return a regular exponent (eg. 12^2
)?
I've tried using ^
, which throws an error, but I can't seem to tell from the docs what notation is supposed to be used for regular exponents.
Here's my code, not much at all:
Debug.Log("text is " + text);
input1 = float.Parse(text.ToString());
Debug.Log("Parsed string to " + input1);
It takes the user input text
and converts it to a float.