Is there any code out there (or a built-in function) which allows outputting a floating point number in engineering notation?
For example, 1.5e-4 would
Here is another version that handles negative and without rounding
public static string ToEngineering(this double value)
{
var absValue = Math.Abs(value);
var exp = absValue < 0.001 ? 0 : (int)(Math.Floor(Math.Log10(absValue) / 3.0) * 3.0);
var newValue = value * Math.Pow(10.0, -exp);
return $"{newValue}e{exp}";
}