Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity convert number to notation

public double number = 1000;
public string numberString = $"Number: {number}";

if (mumber >= 1000) {
  var exponent = (System.Math.Floor(System.Math.Log10(System.Math.Abs(number))));
  var mantissa = (number / System.Math.Pow(10, exponent));
  numberString = $"Number: {mantissa}e{exponent}";
}
else {
  numberString - $"Number: {number}"
}
Source by # #
 
PREVIOUS NEXT
Tagged: #unity #convert #number #notation
ADD COMMENT
Topic
Name
5+2 =