
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)) (t_1 (+ t_0 7.0)) (t_2 (+ t_1 0.5)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(* (* (sqrt (* (PI) 2.0)) (pow t_2 (+ t_0 0.5))) (exp (- t_2)))
(+
(+
(+
(+
(+
(+
(+
(+ 0.9999999999998099 (/ 676.5203681218851 (+ t_0 1.0)))
(/ -1259.1392167224028 (+ t_0 2.0)))
(/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 t_1))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
t_1 := t\_0 + 7\\
t_2 := t\_1 + 0.5\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\left(\sqrt{\mathsf{PI}\left(\right) \cdot 2} \cdot {t\_2}^{\left(t\_0 + 0.5\right)}\right) \cdot e^{-t\_2}\right) \cdot \left(\left(\left(\left(\left(\left(\left(\left(0.9999999999998099 + \frac{676.5203681218851}{t\_0 + 1}\right) + \frac{-1259.1392167224028}{t\_0 + 2}\right) + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_1}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)) (t_1 (+ t_0 7.0)) (t_2 (+ t_1 0.5)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(* (* (sqrt (* (PI) 2.0)) (pow t_2 (+ t_0 0.5))) (exp (- t_2)))
(+
(+
(+
(+
(+
(+
(+
(+ 0.9999999999998099 (/ 676.5203681218851 (+ t_0 1.0)))
(/ -1259.1392167224028 (+ t_0 2.0)))
(/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 t_1))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
t_1 := t\_0 + 7\\
t_2 := t\_1 + 0.5\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\left(\sqrt{\mathsf{PI}\left(\right) \cdot 2} \cdot {t\_2}^{\left(t\_0 + 0.5\right)}\right) \cdot e^{-t\_2}\right) \cdot \left(\left(\left(\left(\left(\left(\left(\left(0.9999999999998099 + \frac{676.5203681218851}{t\_0 + 1}\right) + \frac{-1259.1392167224028}{t\_0 + 2}\right) + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_1}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
(FPCore (z)
:precision binary64
(let* ((t_0 (/ 676.5203681218851 (- 1.0 z)))
(t_1 (fma t_0 (- t_0 0.9999999999998099) 0.9999999999996197))
(t_2 (- (- 1.0 z) 1.0))
(t_3 (* (- (- 1.0 z) -1.0) -0.0007941933558411801)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(*
(sqrt (PI))
(*
(sqrt 2.0)
(exp
(fma (- (- 1.0 z) 0.5) (log1p (- (- z) -6.5)) (+ -1.0 (+ -6.5 z))))))
(+
(+
(+
(+
(+
(+
(/
(fma
1.0
t_1
(*
t_3
(fma (pow (- 1.0 z) -3.0) 309629712.5173946 0.9999999999994297)))
(* t_3 t_1))
(/ 771.3234287776531 (+ t_2 3.0)))
(/ -176.6150291621406 (+ t_2 4.0)))
(/ 12.507343278686905 (- 5.0 z)))
(/ -0.13857109526572012 (+ t_2 6.0)))
(/ 9.984369578019572e-6 (+ t_2 7.0)))
(/ 1.5056327351493116e-7 (+ t_2 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{676.5203681218851}{1 - z}\\
t_1 := \mathsf{fma}\left(t\_0, t\_0 - 0.9999999999998099, 0.9999999999996197\right)\\
t_2 := \left(1 - z\right) - 1\\
t_3 := \left(\left(1 - z\right) - -1\right) \cdot -0.0007941933558411801\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\sqrt{2} \cdot e^{\mathsf{fma}\left(\left(1 - z\right) - 0.5, \mathsf{log1p}\left(\left(-z\right) - -6.5\right), -1 + \left(-6.5 + z\right)\right)}\right)\right) \cdot \left(\left(\left(\left(\left(\left(\frac{\mathsf{fma}\left(1, t\_1, t\_3 \cdot \mathsf{fma}\left({\left(1 - z\right)}^{-3}, 309629712.5173946, 0.9999999999994297\right)\right)}{t\_3 \cdot t\_1} + \frac{771.3234287776531}{t\_2 + 3}\right) + \frac{-176.6150291621406}{t\_2 + 4}\right) + \frac{12.507343278686905}{5 - z}\right) + \frac{-0.13857109526572012}{t\_2 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_2 + 7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_2 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sqrt.f64N/A
pow1/2N/A
pow-to-expN/A
lift-pow.f64N/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
Applied rewrites97.8%
Applied rewrites98.5%
Applied rewrites99.3%
Taylor expanded in z around 0
mul-1-negN/A
unsub-negN/A
lower--.f6499.3
Applied rewrites99.3%
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(*
(sqrt (PI))
(*
(sqrt 2.0)
(exp
(fma (- (- 1.0 z) 0.5) (log1p (- (- z) -6.5)) (+ -1.0 (+ -6.5 z))))))
(+
(+
(+
(+
(+
(+
(+
(+ 0.9999999999998099 (/ 676.5203681218851 (+ t_0 1.0)))
(/
-1259.1392167224028
(+
(fma (- 1.0 (pow z 3.0)) (pow (+ (fma z z z) 1.0) -1.0) -1.0)
2.0)))
(/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 (+ t_0 7.0)))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\sqrt{2} \cdot e^{\mathsf{fma}\left(\left(1 - z\right) - 0.5, \mathsf{log1p}\left(\left(-z\right) - -6.5\right), -1 + \left(-6.5 + z\right)\right)}\right)\right) \cdot \left(\left(\left(\left(\left(\left(\left(\left(0.9999999999998099 + \frac{676.5203681218851}{t\_0 + 1}\right) + \frac{-1259.1392167224028}{\mathsf{fma}\left(1 - {z}^{3}, {\left(\mathsf{fma}\left(z, z, z\right) + 1\right)}^{-1}, -1\right) + 2}\right) + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_0 + 7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sqrt.f64N/A
pow1/2N/A
pow-to-expN/A
lift-pow.f64N/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
Applied rewrites97.8%
Applied rewrites98.5%
lift--.f64N/A
sub-negN/A
lift--.f64N/A
flip3--N/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
lower--.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f64N/A
*-lft-identityN/A
lower-fma.f6498.5
Applied rewrites98.5%
Final simplification98.5%
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(*
(sqrt (PI))
(*
(sqrt 2.0)
(exp
(fma (- (- 1.0 z) 0.5) (log1p (- (- z) -6.5)) (+ -1.0 (+ -6.5 z))))))
(+
(+
(+
(+
(+
(+
(fma
(fma 519.1279660315847 z 361.7355639412844)
z
47.95075976068351)
(/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 (+ t_0 7.0)))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(\sqrt{2} \cdot e^{\mathsf{fma}\left(\left(1 - z\right) - 0.5, \mathsf{log1p}\left(\left(-z\right) - -6.5\right), -1 + \left(-6.5 + z\right)\right)}\right)\right) \cdot \left(\left(\left(\left(\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(519.1279660315847, z, 361.7355639412844\right), z, 47.95075976068351\right) + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_0 + 7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-sqrt.f64N/A
pow1/2N/A
pow-to-expN/A
lift-pow.f64N/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
Applied rewrites97.8%
Applied rewrites98.5%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.5
Applied rewrites98.5%
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(*
(sqrt 2.0)
(* (sqrt (PI)) (* (exp (+ -7.5 z)) (pow (- 7.5 z) (- (- 1.0 z) 0.5)))))
(+
(+
(+
(+
(+
(+
(fma
(fma
(fma 597.824167076735 z 519.1279660315847)
z
361.7355639412844)
z
47.95075976068351)
(/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 7.0))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\sqrt{2} \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \left(e^{-7.5 + z} \cdot {\left(7.5 - z\right)}^{\left(\left(1 - z\right) - 0.5\right)}\right)\right)\right) \cdot \left(\left(\left(\left(\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(597.824167076735, z, 519.1279660315847\right), z, 361.7355639412844\right), z, 47.95075976068351\right) + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6496.5
Applied rewrites96.5%
Taylor expanded in z around 0
Applied rewrites96.5%
Applied rewrites97.4%
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)) (t_1 (sqrt (sqrt (PI)))))
(*
(/ (PI) (sin (* (PI) z)))
(*
(* (* (exp -7.5) (sqrt 15.0)) (* t_1 t_1))
(+
(+
(+
(+
(+
(+ 47.95075976068351 (/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 (+ t_0 7.0)))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
t_1 := \sqrt{\sqrt{\mathsf{PI}\left(\right)}}\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\left(e^{-7.5} \cdot \sqrt{15}\right) \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot \left(\left(\left(\left(\left(\left(47.95075976068351 + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_0 + 7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-PI.f6494.7
Applied rewrites94.7%
Taylor expanded in z around 0
Applied rewrites95.9%
Applied rewrites95.9%
Applied rewrites96.7%
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(* (* (exp -7.5) (sqrt 15.0)) (sqrt (PI)))
(+
(+
(+
(+
(+
(+ 47.95075976068351 (/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 4.0))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 (+ t_0 7.0)))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\left(e^{-7.5} \cdot \sqrt{15}\right) \cdot \sqrt{\mathsf{PI}\left(\right)}\right) \cdot \left(\left(\left(\left(\left(\left(47.95075976068351 + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_0 + 7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-PI.f6494.7
Applied rewrites94.7%
Taylor expanded in z around 0
Applied rewrites95.9%
Applied rewrites95.9%
Taylor expanded in z around 0
Applied rewrites95.9%
(FPCore (z)
:precision binary64
(let* ((t_0 (- (- 1.0 z) 1.0)))
(*
(/ (PI) (sin (* (PI) z)))
(*
(* (sqrt (* 15.0 (PI))) (exp -7.5))
(+
(+
(+
(+
(+
(+ 47.95075976068351 (/ 771.3234287776531 (+ t_0 3.0)))
(/ -176.6150291621406 (+ t_0 4.0)))
(/ 12.507343278686905 (+ t_0 5.0)))
(/ -0.13857109526572012 (+ t_0 6.0)))
(/ 9.984369578019572e-6 (+ t_0 7.0)))
(/ 1.5056327351493116e-7 (+ t_0 8.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - z\right) - 1\\
\frac{\mathsf{PI}\left(\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot z\right)} \cdot \left(\left(\sqrt{15 \cdot \mathsf{PI}\left(\right)} \cdot e^{-7.5}\right) \cdot \left(\left(\left(\left(\left(\left(47.95075976068351 + \frac{771.3234287776531}{t\_0 + 3}\right) + \frac{-176.6150291621406}{t\_0 + 4}\right) + \frac{12.507343278686905}{t\_0 + 5}\right) + \frac{-0.13857109526572012}{t\_0 + 6}\right) + \frac{9.984369578019572 \cdot 10^{-6}}{t\_0 + 7}\right) + \frac{1.5056327351493116 \cdot 10^{-7}}{t\_0 + 8}\right)\right)
\end{array}
\end{array}
Initial program 95.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-exp.f64N/A
lower-sqrt.f64N/A
lower-PI.f6494.7
Applied rewrites94.7%
Taylor expanded in z around 0
Applied rewrites95.9%
Applied rewrites95.9%
Applied rewrites95.9%
herbie shell --seed 2024318
(FPCore (z)
:name "Jmat.Real.gamma, branch z less than 0.5"
:precision binary64
:pre (<= z 0.5)
(* (/ (PI) (sin (* (PI) z))) (* (* (* (sqrt (* (PI) 2.0)) (pow (+ (+ (- (- 1.0 z) 1.0) 7.0) 0.5) (+ (- (- 1.0 z) 1.0) 0.5))) (exp (- (+ (+ (- (- 1.0 z) 1.0) 7.0) 0.5)))) (+ (+ (+ (+ (+ (+ (+ (+ 0.9999999999998099 (/ 676.5203681218851 (+ (- (- 1.0 z) 1.0) 1.0))) (/ -1259.1392167224028 (+ (- (- 1.0 z) 1.0) 2.0))) (/ 771.3234287776531 (+ (- (- 1.0 z) 1.0) 3.0))) (/ -176.6150291621406 (+ (- (- 1.0 z) 1.0) 4.0))) (/ 12.507343278686905 (+ (- (- 1.0 z) 1.0) 5.0))) (/ -0.13857109526572012 (+ (- (- 1.0 z) 1.0) 6.0))) (/ 9.984369578019572e-6 (+ (- (- 1.0 z) 1.0) 7.0))) (/ 1.5056327351493116e-7 (+ (- (- 1.0 z) 1.0) 8.0))))))