+
    i61                         ^ RI HtHtHt ^ RIHtHt ^ RIHtH	t	H
t
 ^ RIt^ RIt^ RIt^ RIt^ RIHt / tR]R&   R]R	&   ]R	,          ]R
&   / tR]R	&   ]R	,          ]R
&   R]R&   / t. RO]R&   . RO]R&   . R O]R&   . R!O]R&   . R"OtR tR#R ltR tR t. t. t] FF  w  tt]],          t]! ]]4      '       d   ]P=                  ]]34       K3  ]P=                  ]]34       KH  	  R tR t R t!R t"R t#R t$R t%R t&R t'R# )$    )xyz)IS_WASMskip)codegenmake_routineget_code_generatorN)Pathzy
program main
  include "codegen.h"
  integer :: result;
  result = 0

  %(statements)s

  call exit(result)
end program
F95z
#include "codegen.h"
#include <stdio.h>
#include <math.h>

int main() {
  int result = 0;

  %(statements)s

  return result;
}
C89C99z
  if (fabs(%(call)s)>%(threshold)s) {
    printf("Numerical validation failed: %(call)s=%%e threshold=%(threshold)s\n", %(call)s);
    result = -1;
  }
z
  if (abs(%(call)s)>%(threshold)s) then
    write(6,"('Numerical validation failed:')")
    write(6,"('%(call)s=',e15.5,'threshold=',e15.5)") %(call)s, %(threshold)s
    result = -1;
  end if
ccgfortrang95ifortc           
     $   \         '       d   R# \        \        P                  R4      ;_uu_ 4       pV  F<  p\        P
                  ! W!R\        P                  R7      pV^ 8w  g   K3   RRR4       R# 	  RRR4       R#   + '       g   i     R# ; i)z>Run a series of commands and only return True if all ran fine.FwT)stdoutshellstderrN)r   openosdevnull
subprocesscallSTDOUT)commandsnullcommandretcodes   &   _/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/external/tests/test_codegen.pytry_runr#   t   sj    w	bjj#		$G oog$%,,.G!| 
	 
  
	 s   1A>'A>2A>>B	c                "   VP                  4       pV\        9   g   Q hV\        9   g   Q h\        P                  ! RR4      P                  4       pVR)9  d   \        R4      h\        P                  ! RV,          RV ,          4      p\        P                  ! 4       p\        P                  ! V4       V'       d   \        WRRR	7       M \        VR4      p	V	P                  VRRR	7       . p
V Fw  w  rrV: R
RP                  R V 4       4      : RV: R2pVR8X  d    \        V4      p\        \!        V4      4      pV
P#                  \        V,          RVRV/,          4       Ky  	  VR8X  d   RpM,VP%                  R4      '       d   RpM\'        RV,          4      h\)        V4      P+                  \        V,          RRP                  V
4      /,          4       \-        V4      pV'       d   \-        R.4      pMRpVR8X  g   VR8X  d   V'       dy   V'       dq   R pV! R4       V! R4       V! R4       V! R4       V! R4       V! R4       V! R4       V! R 4       \        P                  ! V4       \        P.                  ! V4       M8\1        R!V,          \2        P4                  R"7       \        P                  ! V4       V'       g   Q R#V: R$R%P                  V4      : 24       hV'       g   Q R&V: R'R%P                  V4      : 24       hR(# )*aU  A driver for the codegen tests.

This driver assumes that a compiler ifort is present in the PATH and that
ifort is (at least) a Fortran 90 compiler. The generated code is written in
a temporary directory, together with a main program that validates the
generated code. The test passes when the compilation and the validation
run correctly.
SYMPY_TEST_CLEAN_TEMPalwayssuccesszSSYMPY_TEST_CLEAN_TEMP must be one of the following: 'always', 'success' or 'never'.z_sympy_%s_testz%s_r   T)to_files(,c              3   8   "   T F  p\        V4      x  K  	  R # 5iN)str).0args   & r"   	<genexpr>run_test.<locals>.<genexpr>   s     7$3c#hh$s   z)-()r   r   	thresholdzmain.f90Czmain.cz2FIXME: filename extension unknown for language: %s
statements z
./test.exeFc                     \         P                  P                  V 4      '       d   \         P                  ! V 4       R # R # r,   )r   pathisfileremove)filenames   &r"   safe_removerun_test.<locals>.safe_remove   s&    ww~~h''		(# (    zcodegen.f90z	codegen.cz	codegen.hz	codegen.ozmain.oztest.exezTEST NOT REMOVED: %s)filezfailed to compile z code with:

zfailed to execute z code from:
N)r&   r'   never)uppermain_templatenumerical_test_templater   getenvlower
ValueErrortempfilemkdtempgetcwdchdirr   r
   writejoinfortranize_double_constantsr-   append
startswithNotImplementedErrorr   
write_textr#   rmdirprintsysr   )labelroutinesnumerical_testslanguager   friendlycleanworkoldworkcode_gentest_stringsfn_nameargsexpectedr3   call_stringf_namecompiledexecutedr<   s   &&&&&&              r"   run_testrg      s    ~~H}$$$.... II-x8>>@E22noo ,x7GDiikGHHTN  	I=%h	:xT: L.=*xSXX7$77Cu5kBK3C	NCI3H=KA
 
 	 /> 5			S	!	!!@8KM 	M 	Lh<1F"GGI x H L>* Ui/H	$ 	M"K K K JHHJ

$t+#**=
  '$))H%' '8 '$))H%' '8r>   c                   a ^ RI oSP                  R4      pSP                  R4      pV3R lpR pVP                  W04      p VP                  W@4      p V # )z3
Replaces every literal float with literal doubles
Nz\d+(\.)?\d*[eE]-?\d+z\d+\.\d*(?!\d*d)c                 H   < SP                  R RV P                  ^ 4      4      # )z[eE]d)subgroup)matchobjres   &r"   subs_exp-fortranize_double_constants.<locals>.subs_exp   s    vvfc8>>!#455r>   c                 2    R V P                  ^ 4      ,          # )z%sd0)rl   )rm   s   &r"   
subs_float/fortranize_double_constants.<locals>.subs_float   s    q)))r>   )rn   compilerk   )code_stringpattern_exppattern_floatro   rr   rn   s   &    @r"   rN   rN      sV     **45KJJ23M6* //(8K##J<Kr>   c           	      v    \        R \        4      pRR.p \        RV.W0VRR7       R#   \         d     R# i ; i)testis_feasibleF)rZ   T)ry   )      ?r{   V瞯<)ry   )      r}   r|   )r	   r   rg   AssertionError)rY   r   routinerX   s   &&  r"   rz   rz      sJ    61%G%&O	?h	! s   ) 88c                  6    R\         9   d   \        R4       R# R# )r   z*`cc' command didn't work as expected (C89)Nr   r   invalid_lang_compilersr    r>   r"   test_C89_ccr         ..9: /r>   c                  6    R\         9   d   \        R4       R# R# )r   z*`cc' command didn't work as expected (C99)Nr   r   r   r   r>   r"   test_C99_ccr     r   r>   c                  6    R\         9   d   \        R4       R# R# )r   z'`ifort' command didn't work as expectedNr   r   r   r   r>   r"   test_F95_ifortr     s    1167 2r>   c                  6    R\         9   d   \        R4       R# R# )r   z*`gfortran' command didn't work as expectedNr   r   r   r   r>   r"   test_F95_gfortranr     s    449: 5r>   c                  6    R\         9   d   \        R4       R# R# )r   z%`g95' command didn't work as expectedNr   r   r   r   r>   r"   test_F95_g95r   !  s    //45 0r>   c                      RR.p R \         \        ,           \        ,          3.p\         F  w  r#\	        RWW#4       K  	  R# )ry   basic_codegenN)ry   )r{   g      @g      @g      5@r|   )ry   )r}   g       @      r   r|   )r   r   r   valid_lang_commandsrg   )rX   	name_exprlangr   s       r"   test_basic_codegenr   (  s>    .0O 1q5!)$%I-)dM .r>   c                      ^ RI Hp  ^ RIHp ^ RIHp ^ RIHpHpH	p ^ RI
HpHp ^ RIHp ^ RIHp	Hp
HpHpHpHp R\-        \.        4      3R	V	! \.        4      3R
V
! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3RV! \.        4      3.p. pV FA  w  ppR F5  pV ! VP1                  \.        V4      4      pVP3                  VV3VR34       K7  	  KC  	  \4         FR  w  ppVP7                  R4      '       d   RV! \.        4      3RV! \.        4      3.pM. p\9        RVV,           VVV4       KT  	  R# )r   N)ln)log)coshsinhtanh)ceilingfloor)sqrt)acosasinatancossintan	test_fabs	test_acos	test_asin	test_atantest_cos	test_coshtest_logtest_lntest_sin	test_sinh	test_sqrttest_tan	test_tanh+=r4   
test_floor	test_ceilintrinsic_math1N)皙?      ?皙?)sympy.core.evalfr   sympy.functionsr   &sympy.functions.elementary.exponentialr   %sympy.functions.elementary.hyperbolicr   r   r   #sympy.functions.elementary.integersr   r   (sympy.functions.elementary.miscellaneousr   (sympy.functions.elementary.trigonometricr   r   r   r   r   r   absr   subsrO   r   rP   rg   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rX   nameexprxvalrb   r   r   name_expr_Cs                           r"   test_intrinsic_math1_codegenr   2  sf   "":HHD=ZZ	c!f	d1g	d1g	d1g	SV	d1g	SV	BqE	SV	d1g	d1g	SV	d1gI O
d!D1d+,H""D4'8U#CD "   .h??3(%(3k71:5NOKK"I$; $	2 .r>   c                  ^   ^ RI Hp  ^ RIHp RV! \        \
        4      3R\        \
        ,          3.p. pV FV  w  rER FK  w  rgV ! VP                  \        V4      P                  \
        V4      4      pVP                  WFV3VR34       KM  	  KX  	  \         F  w  r\        RW#W4       K  	  R# )	r   r   )atan2
test_atan2test_powr   intrinsic_math2N))r   ?)r   皙ɿ)r   r   )
r   r   r   r   r   r   r   rO   r   rg   )r   r   r   rX   r   r   r   yvalrb   r   r   s              r"   test_instrinsic_math2_codegenr   X  s    ">	uQ{#	QTI O
=JD1d+00D9:H""D,%#HI >   ."IO .r>   c                  j   ^ RI Hp  ^ RIHpHpHp RV! \        4      V! \        4      ,           V! \        4      ,           ^,          P                  4       3RV! V! V! V! V! V! V! V! \        \        ,           \        ,           4      4      4      4      4      4      4      4      3.p. pV Fk  w  rgR F`  w  rp
V ! VP                  \        V4      P                  \        V	4      P                  \        V
4      4      pVP                  WhW3VR34       Kb  	  Km  	  \         F  w  r\        RWEW4       K  	  R# )	r   r   )r   r   r   test1test2g-q=complicated_codegenN))r   r   g333333ӿ)r   r   g        )r   g @r   )r   r   r   r   r   r   r   r   r   expandr   rO   r   rg   )r   r   r   r   r   rX   r   r   r   r   zvalrb   r   r   s                 r"   test_complicated_codegenr   i  s    "HH	CFSVOc!f,q088:;	#c#c#c#c!a%!)n*=&>"?@ABCDI O
 SD1d+00D9>>q$GHH""D*<h#NO !T   .!9t	O .r>   )zcc -c codegen.c -o codegen.ozcc -c main.c -o main.oz#cc main.o codegen.o -lm -o test.exe)z$gfortran -c codegen.f90 -o codegen.oz6gfortran -ffree-line-length-none -c main.f90 -o main.oz%gfortran main.o codegen.o -o test.exe)zg95 -c codegen.f90 -o codegen.oz1g95 -ffree-line-length-huge -c main.f90 -o main.oz g95 main.o codegen.o -o test.exe)z!ifort -c codegen.f90 -o codegen.ozifort -c main.f90 -o main.oz"ifort main.o codegen.o -o test.exe)r   r   r   r   r   )T)(	sympy.abcr   r   r   sympy.testing.pytestr   r   sympy.utilities.codegenr   r	   r
   rU   r   rH   r   pathlibr   rC   rD   compile_commandscombinations_lang_compilerr#   rg   rN   rz   r   r   r   compilerr   rO   r   r   r   r   r   r   r   r   r   r   r>   r"   <module>r      sm  0   . M M 
 	   
 
e e  %U+e   "   "9!?  "              
\'~(   0ND()H4""""D(#34%%tX&67 1;
;
8
;
6N#2LP"Or>   