summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex53
1 files changed, 44 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
index 34a5e406a68..006d6ea4046 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
@@ -805,7 +805,7 @@
}
\newif\ifpgfmathfloatround@allow@empty@mantissa
-\def\pgfmathfloatround@mantissa@ONE{1.0}%
+\def\pgfmathfloatround@mantissa@ONE{1pt }%
% #1: sign
% #2: mantissa
@@ -821,10 +821,38 @@
\ifcase#1\relax
\pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
\expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
- \or\pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
- \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
- \or\pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax%
- \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \or
+ \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1"
+ \ifpgfmathfloatround@allow@empty@mantissa
+ \else
+ \ifdim#2pt=\pgfmathfloatround@mantissa@ONE
+ \def\pgfmathfloat@loc@TMPa{0}% do not draw it.
+ \fi
+ \fi
+ %
+ \if1\pgfmathfloat@loc@TMPa
+ \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \else
+ \def\pgfmathfloat@loc@TMPa{0}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@{#5}{#6}%
+ \fi
+ \or
+ \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1"
+ \ifpgfmathfloatround@allow@empty@mantissa
+ \else
+ \ifdim#2pt=\pgfmathfloatround@mantissa@ONE
+ \def\pgfmathfloat@loc@TMPa{0}% do not draw it.
+ \fi
+ \fi
+ %
+ \if1\pgfmathfloat@loc@TMPa
+ \pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax%
+ \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}%
+ \else
+ \def\pgfmathfloat@loc@TMPa{0}%
+ \pgfmathfloatrounddisplaystyle@shared@impl@{-#5}{#6}%
+ \fi
\or
\pgfmathfloatrounddisplaystyle@shared@impl@@{\hbox{NaN}}{}%
\or
@@ -1049,8 +1077,15 @@
@sci exponent mark=,
}%
},
-% sci may skip mantissa/.is if=pgfmathfloatround@allow@empty@mantissa,
-% sci may skip mantissa/.default=true,
+ retain unit mantissa/.is if=pgfmathfloatround@allow@empty@mantissa,
+ retain unit mantissa/.default=true,
+ retain unit mantissa=true,
+ %
+ % allows to replace the implementation, for example
+ % 'implementation=\num'. This is experimental -- it is inclear
+ % if all consumers work well since they rely on the keys in
+ % /pgf/number format.
+ implementation/.code={\def\pgfmathprintnumber@protected{#1}},
}
@@ -1121,7 +1156,7 @@
}
\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn{%
- \immediate\write16{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}%
+ \pgf@typeout{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}%
\global\let\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn=\relax
}
@@ -1389,7 +1424,7 @@
\ifnum\pgfmathresultdenom>1000
\pgfutil@ifundefined{FPdiv}{%
\pgfmathfloattosci@\pgfmathfloat@arg
- \immediate\write16{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}%
+ \pgf@typeout{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}%
}{}%
\fi
\fi