I use \pgfmath for computation of floating point numbers a lot. But I want to store the result of each computation and store it in a variable and then use back to perform another floating point arithmetic.

The small signal parameters are given as,\\
$g_{m}=\dfrac{2I_{D}}{V_{OV}}$\; and\; $r_{o}=\dfrac{\lambda}{I_{D}}$\\
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=sci}

 \Mr3 \times  \pgfutilensuremath{10^{\Er3}}$;

and now I want to perform the following operation

$A=g_{m1,2}\cdot r_{o3,4}$

Also, I need a macro to pass in different values and get results onto different variables.

  • Why don't you just use a different macro so you aren't overwriting \pgfmathresult? I don't really understand the question, I guess. Can you make your fragment into an MWE? – cfr Mar 13 '17 at 3:18

Store the intermediate results by \let\XX{\pgfmathresult} and then retrieve the results later whenever needed. Note: There are few thinks that are to be kept in mind

  1. The variable \XX should not contain any number.
  2. Remove the local scope while defining. I.e., in the above code, I tried to use \let\XX within $ $(which actually act as a local scope).

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.