Post Reply 
Long decimal results instead of scientific notation?
06-24-2021, 01:16 PM
Post: #5
RE: Long decimal results instead of scientific notation?
I came up with a program to print 9.81e-21 in the format you wanted.

It is free form, off the cuff, coding at the keyboard with no optimization.

I hope to recode it later.

Code:

EXPORT numstr01()
BEGIN
local i;
local n,nl,na,nal;
local s,z;
local zi,zl;
local t1,t2,t3;
local t4;
local newline;
print;
newline := "\n";
z :="0";
n := 9.81e-21;
nl := log(n);
// print(n + ", " + nl + ", " + z );
// print(newline);
na := abs(nl);
zl := trunc(na);
// print (na + ", " + zl);
t1 := nl + zl;
t2 := 10^t1;
// print(newline);
// print(t1 + ", " + t2);
t3 := trunc(1000*t2);
// print(t3);
t4 := "0.";
for i from 1 to zl
do
t4 := t4 + z;
end;
print(n+" = " + t4+t3);
END;

Not one for the software engineers but it gets the job done.

Cheers.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Long decimal results instead of scientific notation? - Liamtoh Resu - 06-24-2021 01:16 PM



User(s) browsing this thread: 1 Guest(s)