0

When I calculate very small numbers, I use the fpu package. But it seems \pgfkeys{/pgf/fpu=false} does not work.

\documentclass[dvipdfmx]{article}

% packages
\usepackage{pgf}
\usepackage{tikz}

% libraries for tikz
\usetikzlibrary{fpu}

\begin{document}

    \pgfkeys{/pgf/fpu=true, pgf/fpu/output format=fixed}    
    \pgfmathsetmacro{\Gu}{6.67*10^(-11)}
    \pgfkeys{/pgf/fpu=false}
    \pgfmathsetmacro{\Mc}{5.0*random(10,14)}    

\end{document}

If execute this, an error occurs:

Package PGF Math Error: the operation 'random' has not yet been implemented in the floating point unit :-( (in '5.0*random(10,14)').

Anything wrong?

10
  • 1
    Is this a copy-paste error, ¥Gu and ¥Mc? It's probably supposed to be \Gu and \Mc. May 21 '19 at 6:33
  • Cannot reproduce. No error for me with PGF 3.1.3 and master. May 21 '19 at 6:34
  • Henri, thank you. Your comment is right. May 21 '19 at 6:42
  • 4
    I'm voting to close this question as off-topic because it's due to a typo (¥Gu instead of \Gu and ¥Mc instead of \Mc). May 21 '19 at 14:15
  • @PhelypeOleinik when the names are changed the same error occurs, so it should not be closed because of this.
    – Marijn
    May 21 '19 at 16:33
2

This bug has long been fixed. Update your TeX distribution.

https://github.com/pgf-tikz/pgf/commit/061d5c7153bb7eece61f38ae31486de7bb939493

\documentclass[dvipdfmx]{article}

% packages
\usepackage{pgf}
\usepackage{tikz}

% libraries for tikz
\usetikzlibrary{fpu}

% has to come after \usetikzlibrary{fpu}!
\makeatletter
\def\pgfmathfloat@install@unimplemented#1{%
  \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath#1@\endcsname%
  \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}%
}
\makeatother

\begin{document}

    \pgfkeys{/pgf/fpu=true, pgf/fpu/output format=fixed}    
    \pgfmathsetmacro{\Gu}{6.67*10^(-11)}
    \pgfkeys{/pgf/fpu=false}
    \pgfmathsetmacro{\Mc}{5.0*random(10,14)}    

\end{document}
1
  • Thank you very much. My problem has been solved by PGF update to latest version. May 22 '19 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.