<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%% $Id: pst-calculate.sty 920 2019-01-24 20:24:45Z herbert $
%%
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.3 or, at your option, any later version.
%%
% Copyright 2018 Herbert Voss hvoss@tug.org
%%
\def\pstcalculate@version{0.02}
\ProvidesPackage{pst-calculate}[%
  2019/01/24 v. \pstcalculate@version (Herbert Voss) Support for 
  caculations with floating  point numbers.] 
%
\RequirePackage{xkeyval}

\newif\ifcalc@useComma \calc@useCommafalse
\DeclareOptionX{useComma}[true]{\@nameuse{calc@useComma#1}}
%
\let\calc@roundDigit\relax
\DeclareOptionX{roundDigit}{\def\calc@roundDigit{#1}}

\DeclareOptionX*{\PassOptionsToPackage\CurrentOption{siunitx}}

\ProcessOptionsX\relax

\RequirePackage{xparse,siunitx}

\ifx\relax\calc@roundDigit \else 
  \sisetup{round-mode=places,round-precision=\calc@roundDigit}% 
\fi
\ifcalc@useComma  
  \sisetup{output-decimal-marker={,}} 
\fi

\ExplSyntaxOn
\DeclareExpandableDocumentCommand\ps@Calculate{m}{\fp_to_decimal:n{#1}}%
%\DeclareExpandableDocumentCommand\ps@@Calculate{m}{\fp_to_int:n{#1}}%
%\DeclareExpandableDocumentCommand\ps@@@Calculate{m}{\fp_to_scientific:n{#1}}%
\ExplSyntaxOff

\def\pst@calculateType{0}

\def\psCalculate{\@ifnextchar[\psCalculate@i{\psCalculate@i[]}}

\def\psCalculate@i[#1]#2{%
  \begingroup
  \ifx\relax#1\relax\else\sisetup{#1}\fi
  \num{\ps@Calculate{#2}}
  \endgroup
  \ignorespaces
}

\let\pscalculate\ps@Calculate

%%
\endinput

</pre></body></html>