squirrel

Squirrel: How to print without e^?


local MAX = 0.059513641346164345134111361369;
print( MAX );

Output: 0.661467

local MAX = 0.000000000000000000000000000001;
print( MAX );

Output: 1e-030

I want to display the entire 30 digits after the decimal point.


Solution

  • You can use squirrel's format() function, it behaves like printf in C

    local MAX = 0.059513641346164345134111361369;
    print(format("%.30f", MAX));
    
    local MAX = 0.000000000000000000000000000001;
    print(format("%.30f", MAX));
    

    You must specify how many digits to print after the comma (in this case 30)