- Home /
How to get floats value without including exponential notation
Hello ,
public double num;
num = 9999987991231239f;
Debug.Log(num.ToString()); //Doesn't print the number
text.text = num.ToString(); //Doesn't print the number
I have tried num.ToString("0");
but nothing is helping.
I want to perform some calculations on that number (displayed on label ).
I want float/double to be printed without exponential notation. Plz Help
Answer by EvilTak · Dec 07, 2014 at 07:16 AM
You should use num.ToString("F")
. You can specify the number of decimal places also by using num.ToString("Fn")
where n is your number. Or you can use a custom format specifier like num.ToString("0.#######")
.
@Evil Tak : It prints right up to first 7 digits but after that it prints random numbers.
Try using ToString("F20") or any other number in place of 20.
Your answer
![](https://koobas.hobune.stream/wayback/20220613173430im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trying to move an object towards another's axis. 1 Answer
A problem with intersection detection 1 Answer
How do i get the part of a float after the point? 7 Answers
Casting-related error: "^ cannot be applied to double and int" 1 Answer
getting the lowest point of a sine wave in javascript 3 Answers