diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-05-18 16:15:15 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-05-18 16:15:15 +0200 |
commit | 19e74d8d40e9b9fcfbed14174e19ad7af64d3072 (patch) | |
tree | 8e5b6eb3a2a90f9c9c6617302b4b8d65e5140711 /tex/context/base/util-str.lua | |
parent | cd12b5497dc4a12dc33751a0deffda08b26bcbcd (diff) | |
download | context-19e74d8d40e9b9fcfbed14174e19ad7af64d3072.tar.gz |
2014-05-18 15:59:00
Diffstat (limited to 'tex/context/base/util-str.lua')
-rw-r--r-- | tex/context/base/util-str.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua index 52c48badd..5609cdf25 100644 --- a/tex/context/base/util-str.lua +++ b/tex/context/base/util-str.lua @@ -284,6 +284,7 @@ end -- octal %...o number -- string %...s string number -- float %...f number +-- checked float %...F number -- exponential %...e number -- exponential %...E number -- autofloat %...g number @@ -526,7 +527,11 @@ end local format_F = function(f) n = n + 1 - return format("((a%s == 0 and '0') or (a%s == 1 and '1') or format('%%%sf',a%s))",n,n,f,n) + if not f or f == "" then + return format("(((a%s > -0.0000000005 and a%s < 0.0000000005) and '0') or (a%s == 1 and '1') or format('%%.9f',a%s))",n,n,n,n) + else + return format("((a%s == 0 and '0') or (a%s == 1 and '1') or format('%%%sf',a%s))",n,n,f,n) + end end local format_g = function(f) |