%%
%% This is file `pgfmath-xfp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pgfmath-xfp.dtx  (with options: `pkg')
%% 
%% --------------------------------------------------------------
%% pgfmath-xfp -- define pgfmath functions using xfp
%% E-mail: jspratte@yahoo.de
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% --------------------------------------------------------------
%% 
%% Copyright (C) 2020-2021 Jonathan P. Spratte
%% 
%% This  work may be  distributed and/or  modified under  the conditions  of the
%% LaTeX Project Public License (LPPL),  either version 1.3c  of this license or
%% (at your option) any later version.  The latest version of this license is in
%% the file:
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Jonathan P. Spratte.
%% 
%% This work consists of the file  pgfmath-xfp.dtx
%% and the derived files           pgfmath-xfp.pdf
%%                                 pgfmath-xfp.sty
%% 
\providecommand\DeclareRelease[3]{}
\providecommand\DeclareCurrentRelease[2]{}
\DeclareCurrentRelease{}{2021-05-19}
\@ifundefined{ExplFileDate}
  {\RequirePackage{expl3}}
  {}
\RequirePackage{pgfmath}
\usepgflibrary{fpu}
\newcommand*\pgfmxfpDate{2021-05-19}
\newcommand*\pgfmxfpVersion{1.0}
\ProvidesExplPackage
  {pgfmath-xfp}     {\pgfmxfpDate}
  {\pgfmxfpVersion} {define pgfmath functions using xfp}
\NewDocumentCommand \pgfmxfpdeclarefunction { m m o m }
  {
    \IfValueTF {#3}
      { \pgfmxfp_declare_processed_args:nnnn {#1} {#2} {#3} }
      { \pgfmxfp_declare:nnn {#1} {#2} }
      {#4}
  }
\cs_new_protected:Npn \pgfmxfp_declare:nnn #1#2#3
  {
    \__pgfmxfp_initialize_body:
    \int_step_inline:nn {#2}
      {
        \tl_put_right:Nx \l__pgfmxfp_function_body_tl
          {
            \exp_not:n { \pgfmathsetmacro } \exp_not:c { __pgfmxfp_arg##1 }
              { \exp_not:n {####} ##1 }
          }
      }
    \__pgfmxfp_define_function:nnnn {#2} {#1} {#2} {#3}
  }
\cs_new_protected:Npn \pgfmxfp_declare_processed_args:nnnn #1#2#3#4
  {
    \__pgfmxfp_initialize_body:
    \int_zero:N \l__pgfmxfp_args_int
    \clist_map_inline:nn {#3}
      {
        \int_incr:N \l__pgfmxfp_args_int
        \tl_put_right:Nx \l__pgfmxfp_function_body_tl
          {
            \exp_not:n { \pgfmathsetmacro }
              \exp_not:c { __pgfmxfp_arg \int_use:N \l__pgfmxfp_args_int }
              { \exp_not:n {##1} }
          }
      }
    \exp_args:NV \__pgfmxfp_define_function:nnnn \l__pgfmxfp_args_int {#1} {#2} {#4}
  }
\tl_new:N \l__pgfmxfp_function_body_tl
\int_new:N \l__pgfmxfp_args_int
\cs_new_protected:Npn \__pgfmxfp_initialize_body:
  {
    \tl_set:Nn \l__pgfmxfp_function_body_tl
      {
        \group_begin:
        \pgfkeys{/pgf/fpu=true, /pgf/fpu/output~format=sci}%
      }
  }
\cs_new_protected:Npn \__pgfmxfp_define_function:nnnn #1#2#3#4
  {
    \__pgfmxfp_define_internal_function:nnn {#1} {#2} {#4}
    \tl_put_right:Nx \l__pgfmxfp_function_body_tl
      {
        \use:x
          {
            \exp_not:c { __pgfmxfp_function_ #2 _cmd }
            \int_step_function:nN {#1} \__pgfmxfp_define_function_aux:n
          }
      }
    \exp_args:Nnno
    \pgfmathdeclarefunction {#2} {#3} \l__pgfmxfp_function_body_tl
  }
\cs_new:Npn \__pgfmxfp_define_function_aux:n #1 { { \exp_not:c { __pgfmxfp_arg#1 } } }
\cs_new_protected:Npn \__pgfmxfp_define_internal_function:nnn #1#2#3
  {
    \exp_last_unbraced:Nx
    \cs_set_protected:cpn
      {
        { __pgfmxfp_function_ #2 _cmd }
        \int_step_function:nN {#1} \__pgfmxfp_define_internal_function_aux:n
      }
      { \group_end: \exp_args:Nf \pgfmathparse { \fp_eval:n {#3} } }
  }
\cs_new:Npn \__pgfmxfp_define_internal_function_aux:n #1 { \exp_not:n {## #1} }
\ExplSyntaxOff
%% 
%%
%% End of file `pgfmath-xfp.sty'.
