Scientific Notation
Is it possible to display numbers in scientific notation? e.g. 1.234567e+6
Thanks.
2 replies
-
not yet, no :-(
Birger
-
I think I've got this worked out, but if you try it and find errors let me know. The number field can't have any formatting for the formula to work. The field name I used is "Number" and it converted to text and assigned to "myNum". Here is the formula that would be entered into a formula field...
let myNum := text(Number);
let isNeg := 0;
if substr(myNum, 0, 1) = "-" then
isNeg := 1
end;
if number(myNum) = 0 then
"0e0"
else
if not contains(myNum, ".") then
let exp := length(myNum) - 1 - isNeg;
if exp >= 1 then
substr(myNum, 0, 1 + isNeg) + "." + substr(myNum, 1 + isNeg, length(myNum) - length(extractx(myNum, "0*$")) - 1) + "e" + exp
else
substr(myNum, 0) + "e" + exp
end
else
if abs(number(myNum)) < 1 then
let exp := length(extractx(myNum, "^-?0.0*"));
if isNeg then "-" end + substr(myNum, exp, 1) + "." + substr(myNum, exp + 1) + "e-" + (exp - 1 - isNeg)
else
let exp := text(index(myNum, ".") - 1 - isNeg);
substr(myNum, 0, 1 + isNeg) + "." + substr(myNum, 1 + isNeg, index(myNum, ".") - 1 - isNeg) + substr(myNum, index(myNum, ".") + 1) + "e" + exp
end
end
end
Content aside
- 5 yrs agoLast active
- 2Replies
- 1031Views