
(FPCore (x y z)
:precision binary64
(+
x
(/
(*
y
(+
(* (+ (* z 0.0692910599291889) 0.4917317610505968) z)
0.279195317918525))
(+ (* (+ z 6.012459259764103) z) 3.350343815022304))))
double code(double x, double y, double z) {
return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0))
end function
public static double code(double x, double y, double z) {
return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
def code(x, y, z): return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))
function code(x, y, z) return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304))) end
function tmp = code(x, y, z) tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304)); end
code[x_, y_, z_] := N[(x + N[(N[(y * N[(N[(N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision] * z), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z + 6.012459259764103), $MachinePrecision] * z), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
(+
x
(/
(*
y
(+
(* (+ (* z 0.0692910599291889) 0.4917317610505968) z)
0.279195317918525))
(+ (* (+ z 6.012459259764103) z) 3.350343815022304))))
double code(double x, double y, double z) {
return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0))
end function
public static double code(double x, double y, double z) {
return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304));
}
def code(x, y, z): return x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304))
function code(x, y, z) return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304))) end
function tmp = code(x, y, z) tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) / (((z + 6.012459259764103) * z) + 3.350343815022304)); end
code[x_, y_, z_] := N[(x + N[(N[(y * N[(N[(N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision] * z), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z + 6.012459259764103), $MachinePrecision] * z), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}
\end{array}
(FPCore (x y z)
:precision binary64
(if (<= z -5.5)
(+
x
(*
y
(-
0.0692910599291889
(/ (+ (/ 0.4046220386999212 z) -0.07512208616047561) z))))
(if (<= z 7.6e-5)
(+ x (* y (+ 0.08333333333333323 (* z -0.00277777777751721))))
(+ x (* y (+ 0.0692910599291889 (/ 0.07512208616047561 z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5) {
tmp = x + (y * (0.0692910599291889 - (((0.4046220386999212 / z) + -0.07512208616047561) / z)));
} else if (z <= 7.6e-5) {
tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
} else {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-5.5d0)) then
tmp = x + (y * (0.0692910599291889d0 - (((0.4046220386999212d0 / z) + (-0.07512208616047561d0)) / z)))
else if (z <= 7.6d-5) then
tmp = x + (y * (0.08333333333333323d0 + (z * (-0.00277777777751721d0))))
else
tmp = x + (y * (0.0692910599291889d0 + (0.07512208616047561d0 / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.5) {
tmp = x + (y * (0.0692910599291889 - (((0.4046220386999212 / z) + -0.07512208616047561) / z)));
} else if (z <= 7.6e-5) {
tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
} else {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5: tmp = x + (y * (0.0692910599291889 - (((0.4046220386999212 / z) + -0.07512208616047561) / z))) elif z <= 7.6e-5: tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721))) else: tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5) tmp = Float64(x + Float64(y * Float64(0.0692910599291889 - Float64(Float64(Float64(0.4046220386999212 / z) + -0.07512208616047561) / z)))); elseif (z <= 7.6e-5) tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * -0.00277777777751721)))); else tmp = Float64(x + Float64(y * Float64(0.0692910599291889 + Float64(0.07512208616047561 / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5) tmp = x + (y * (0.0692910599291889 - (((0.4046220386999212 / z) + -0.07512208616047561) / z))); elseif (z <= 7.6e-5) tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721))); else tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5], N[(x + N[(y * N[(0.0692910599291889 - N[(N[(N[(0.4046220386999212 / z), $MachinePrecision] + -0.07512208616047561), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e-5], N[(x + N[(y * N[(0.08333333333333323 + N[(z * -0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(0.0692910599291889 + N[(0.07512208616047561 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5:\\
\;\;\;\;x + y \cdot \left(0.0692910599291889 - \frac{\frac{0.4046220386999212}{z} + -0.07512208616047561}{z}\right)\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.0692910599291889 + \frac{0.07512208616047561}{z}\right)\\
\end{array}
\end{array}
if z < -5.5Initial program 46.0%
remove-double-neg46.0%
associate-/l*52.7%
distribute-rgt-neg-in52.7%
distribute-lft-neg-in52.7%
distribute-lft-neg-in52.7%
distribute-rgt-neg-in52.7%
remove-double-neg52.7%
fma-define52.7%
fma-define52.8%
fma-define52.8%
Simplified52.8%
Taylor expanded in z around -inf 99.6%
mul-1-neg99.6%
unsub-neg99.6%
sub-neg99.6%
associate-*r/99.6%
metadata-eval99.6%
metadata-eval99.6%
Simplified99.6%
if -5.5 < z < 7.6000000000000004e-5Initial program 99.6%
remove-double-neg99.6%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
remove-double-neg99.8%
fma-define99.8%
fma-define99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
if 7.6000000000000004e-5 < z Initial program 39.0%
remove-double-neg39.0%
associate-/l*54.4%
distribute-rgt-neg-in54.4%
distribute-lft-neg-in54.4%
distribute-lft-neg-in54.4%
distribute-rgt-neg-in54.4%
remove-double-neg54.4%
fma-define54.4%
fma-define54.4%
fma-define54.4%
Simplified54.4%
Taylor expanded in z around inf 99.7%
associate-*r/99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(if (<=
(/
(*
y
(+
(* z (+ (* z 0.0692910599291889) 0.4917317610505968))
0.279195317918525))
(+ (* z (+ z 6.012459259764103)) 3.350343815022304))
1e+292)
(+
x
(*
y
(/
(fma (fma z 0.0692910599291889 0.4917317610505968) z 0.279195317918525)
(fma (+ z 6.012459259764103) z 3.350343815022304))))
(+ x (* y (+ 0.0692910599291889 (/ 0.07512208616047561 z))))))
double code(double x, double y, double z) {
double tmp;
if (((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) <= 1e+292) {
tmp = x + (y * (fma(fma(z, 0.0692910599291889, 0.4917317610505968), z, 0.279195317918525) / fma((z + 6.012459259764103), z, 3.350343815022304)));
} else {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(y * Float64(Float64(z * Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) <= 1e+292) tmp = Float64(x + Float64(y * Float64(fma(fma(z, 0.0692910599291889, 0.4917317610505968), z, 0.279195317918525) / fma(Float64(z + 6.012459259764103), z, 3.350343815022304)))); else tmp = Float64(x + Float64(y * Float64(0.0692910599291889 + Float64(0.07512208616047561 / z)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(y * N[(N[(z * N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision]), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision], 1e+292], N[(x + N[(y * N[(N[(N[(z * 0.0692910599291889 + 0.4917317610505968), $MachinePrecision] * z + 0.279195317918525), $MachinePrecision] / N[(N[(z + 6.012459259764103), $MachinePrecision] * z + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(0.0692910599291889 + N[(0.07512208616047561 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 10^{+292}:\\
\;\;\;\;x + y \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), z, 0.279195317918525\right)}{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.0692910599291889 + \frac{0.07512208616047561}{z}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))) < 1e292Initial program 95.7%
remove-double-neg95.7%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
remove-double-neg99.8%
fma-define99.8%
fma-define99.8%
fma-define99.8%
Simplified99.8%
if 1e292 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))) Initial program 0.9%
remove-double-neg0.9%
associate-/l*11.3%
distribute-rgt-neg-in11.3%
distribute-lft-neg-in11.3%
distribute-lft-neg-in11.3%
distribute-rgt-neg-in11.3%
remove-double-neg11.3%
fma-define11.3%
fma-define11.3%
fma-define11.3%
Simplified11.3%
Taylor expanded in z around inf 99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(if (<=
(/
(*
y
(+
(* z (+ (* z 0.0692910599291889) 0.4917317610505968))
0.279195317918525))
(+ (* z (+ z 6.012459259764103)) 3.350343815022304))
1e+292)
(fma
(fma z (* z 0.0692910599291889) 0.279195317918525)
(/ y (fma z (+ z 6.012459259764103) 3.350343815022304))
x)
(+ x (* y (+ 0.0692910599291889 (/ 0.07512208616047561 z))))))
double code(double x, double y, double z) {
double tmp;
if (((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) <= 1e+292) {
tmp = fma(fma(z, (z * 0.0692910599291889), 0.279195317918525), (y / fma(z, (z + 6.012459259764103), 3.350343815022304)), x);
} else {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(y * Float64(Float64(z * Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) <= 1e+292) tmp = fma(fma(z, Float64(z * 0.0692910599291889), 0.279195317918525), Float64(y / fma(z, Float64(z + 6.012459259764103), 3.350343815022304)), x); else tmp = Float64(x + Float64(y * Float64(0.0692910599291889 + Float64(0.07512208616047561 / z)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(y * N[(N[(z * N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision]), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision], 1e+292], N[(N[(z * N[(z * 0.0692910599291889), $MachinePrecision] + 0.279195317918525), $MachinePrecision] * N[(y / N[(z * N[(z + 6.012459259764103), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(y * N[(0.0692910599291889 + N[(0.07512208616047561 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z \cdot \left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, z \cdot 0.0692910599291889, 0.279195317918525\right), \frac{y}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.0692910599291889 + \frac{0.07512208616047561}{z}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))) < 1e292Initial program 95.7%
+-commutative95.7%
*-commutative95.7%
associate-/l*98.6%
fma-define98.6%
*-commutative98.6%
fma-define98.6%
fma-define98.6%
*-commutative98.6%
fma-define98.6%
Simplified98.6%
Taylor expanded in z around inf 97.8%
*-commutative97.8%
Simplified97.8%
if 1e292 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 692910599291889/10000000000000000 binary64)) #s(literal 307332350656623/625000000000000 binary64)) z) #s(literal 11167812716741/40000000000000 binary64))) (+.f64 (*.f64 (+.f64 z #s(literal 6012459259764103/1000000000000000 binary64)) z) #s(literal 104698244219447/31250000000000 binary64))) Initial program 0.9%
remove-double-neg0.9%
associate-/l*11.3%
distribute-rgt-neg-in11.3%
distribute-lft-neg-in11.3%
distribute-lft-neg-in11.3%
distribute-rgt-neg-in11.3%
remove-double-neg11.3%
fma-define11.3%
fma-define11.3%
fma-define11.3%
Simplified11.3%
Taylor expanded in z around inf 99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5) (not (<= z 7.6e-5))) (+ x (* y (+ 0.0692910599291889 (/ 0.07512208616047561 z)))) (+ x (* y (+ 0.08333333333333323 (* z -0.00277777777751721))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 7.6e-5)) {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
} else {
tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.5d0)) .or. (.not. (z <= 7.6d-5))) then
tmp = x + (y * (0.0692910599291889d0 + (0.07512208616047561d0 / z)))
else
tmp = x + (y * (0.08333333333333323d0 + (z * (-0.00277777777751721d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 7.6e-5)) {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
} else {
tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5) or not (z <= 7.6e-5): tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z))) else: tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5) || !(z <= 7.6e-5)) tmp = Float64(x + Float64(y * Float64(0.0692910599291889 + Float64(0.07512208616047561 / z)))); else tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * -0.00277777777751721)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.5) || ~((z <= 7.6e-5))) tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z))); else tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5], N[Not[LessEqual[z, 7.6e-5]], $MachinePrecision]], N[(x + N[(y * N[(0.0692910599291889 + N[(0.07512208616047561 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(0.08333333333333323 + N[(z * -0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \lor \neg \left(z \leq 7.6 \cdot 10^{-5}\right):\\
\;\;\;\;x + y \cdot \left(0.0692910599291889 + \frac{0.07512208616047561}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\
\end{array}
\end{array}
if z < -5.5 or 7.6000000000000004e-5 < z Initial program 42.6%
remove-double-neg42.6%
associate-/l*53.5%
distribute-rgt-neg-in53.5%
distribute-lft-neg-in53.5%
distribute-lft-neg-in53.5%
distribute-rgt-neg-in53.5%
remove-double-neg53.5%
fma-define53.5%
fma-define53.6%
fma-define53.6%
Simplified53.6%
Taylor expanded in z around inf 99.5%
associate-*r/99.5%
metadata-eval99.5%
Simplified99.5%
if -5.5 < z < 7.6000000000000004e-5Initial program 99.6%
remove-double-neg99.6%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
remove-double-neg99.8%
fma-define99.8%
fma-define99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5) (not (<= z 7.6e-5))) (+ x (* y (+ 0.0692910599291889 (/ 0.07512208616047561 z)))) (+ x (* y 0.08333333333333323))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 7.6e-5)) {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
} else {
tmp = x + (y * 0.08333333333333323);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.5d0)) .or. (.not. (z <= 7.6d-5))) then
tmp = x + (y * (0.0692910599291889d0 + (0.07512208616047561d0 / z)))
else
tmp = x + (y * 0.08333333333333323d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 7.6e-5)) {
tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z)));
} else {
tmp = x + (y * 0.08333333333333323);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5) or not (z <= 7.6e-5): tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z))) else: tmp = x + (y * 0.08333333333333323) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5) || !(z <= 7.6e-5)) tmp = Float64(x + Float64(y * Float64(0.0692910599291889 + Float64(0.07512208616047561 / z)))); else tmp = Float64(x + Float64(y * 0.08333333333333323)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.5) || ~((z <= 7.6e-5))) tmp = x + (y * (0.0692910599291889 + (0.07512208616047561 / z))); else tmp = x + (y * 0.08333333333333323); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5], N[Not[LessEqual[z, 7.6e-5]], $MachinePrecision]], N[(x + N[(y * N[(0.0692910599291889 + N[(0.07512208616047561 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.08333333333333323), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \lor \neg \left(z \leq 7.6 \cdot 10^{-5}\right):\\
\;\;\;\;x + y \cdot \left(0.0692910599291889 + \frac{0.07512208616047561}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.08333333333333323\\
\end{array}
\end{array}
if z < -5.5 or 7.6000000000000004e-5 < z Initial program 42.6%
remove-double-neg42.6%
associate-/l*53.5%
distribute-rgt-neg-in53.5%
distribute-lft-neg-in53.5%
distribute-lft-neg-in53.5%
distribute-rgt-neg-in53.5%
remove-double-neg53.5%
fma-define53.5%
fma-define53.6%
fma-define53.6%
Simplified53.6%
Taylor expanded in z around inf 99.5%
associate-*r/99.5%
metadata-eval99.5%
Simplified99.5%
if -5.5 < z < 7.6000000000000004e-5Initial program 99.6%
+-commutative99.6%
*-commutative99.6%
associate-/l*99.6%
fma-define99.6%
*-commutative99.6%
fma-define99.6%
fma-define99.6%
*-commutative99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.5) (not (<= z 7.6e-5))) (+ x (* y 0.0692910599291889)) (+ x (* y 0.08333333333333323))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 7.6e-5)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + (y * 0.08333333333333323);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.5d0)) .or. (.not. (z <= 7.6d-5))) then
tmp = x + (y * 0.0692910599291889d0)
else
tmp = x + (y * 0.08333333333333323d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.5) || !(z <= 7.6e-5)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + (y * 0.08333333333333323);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.5) or not (z <= 7.6e-5): tmp = x + (y * 0.0692910599291889) else: tmp = x + (y * 0.08333333333333323) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.5) || !(z <= 7.6e-5)) tmp = Float64(x + Float64(y * 0.0692910599291889)); else tmp = Float64(x + Float64(y * 0.08333333333333323)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.5) || ~((z <= 7.6e-5))) tmp = x + (y * 0.0692910599291889); else tmp = x + (y * 0.08333333333333323); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.5], N[Not[LessEqual[z, 7.6e-5]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.08333333333333323), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \lor \neg \left(z \leq 7.6 \cdot 10^{-5}\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.08333333333333323\\
\end{array}
\end{array}
if z < -5.5 or 7.6000000000000004e-5 < z Initial program 42.6%
+-commutative42.6%
*-commutative42.6%
associate-/l*52.0%
fma-define52.0%
*-commutative52.0%
fma-define52.0%
fma-define52.0%
*-commutative52.0%
fma-define52.0%
Simplified52.0%
Taylor expanded in z around inf 99.0%
+-commutative99.0%
Simplified99.0%
if -5.5 < z < 7.6000000000000004e-5Initial program 99.6%
+-commutative99.6%
*-commutative99.6%
associate-/l*99.6%
fma-define99.6%
*-commutative99.6%
fma-define99.6%
fma-define99.6%
*-commutative99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (<= x -6.2e-164) x (if (<= x 3.6e+15) (* y 0.0692910599291889) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e-164) {
tmp = x;
} else if (x <= 3.6e+15) {
tmp = y * 0.0692910599291889;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-6.2d-164)) then
tmp = x
else if (x <= 3.6d+15) then
tmp = y * 0.0692910599291889d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e-164) {
tmp = x;
} else if (x <= 3.6e+15) {
tmp = y * 0.0692910599291889;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.2e-164: tmp = x elif x <= 3.6e+15: tmp = y * 0.0692910599291889 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.2e-164) tmp = x; elseif (x <= 3.6e+15) tmp = Float64(y * 0.0692910599291889); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.2e-164) tmp = x; elseif (x <= 3.6e+15) tmp = y * 0.0692910599291889; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.2e-164], x, If[LessEqual[x, 3.6e+15], N[(y * 0.0692910599291889), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-164}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+15}:\\
\;\;\;\;y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.2000000000000001e-164 or 3.6e15 < x Initial program 71.3%
+-commutative71.3%
*-commutative71.3%
associate-/l*76.4%
fma-define76.4%
*-commutative76.4%
fma-define76.4%
fma-define76.4%
*-commutative76.4%
fma-define76.4%
Simplified76.4%
Taylor expanded in y around 0 72.9%
if -6.2000000000000001e-164 < x < 3.6e15Initial program 67.1%
+-commutative67.1%
*-commutative67.1%
associate-/l*71.8%
fma-define71.8%
*-commutative71.8%
fma-define71.8%
fma-define71.8%
*-commutative71.8%
fma-define71.8%
Simplified71.8%
Taylor expanded in z around inf 68.7%
+-commutative68.7%
Simplified68.7%
Taylor expanded in y around inf 51.4%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.35e+267) (* y 0.08333333333333323) (+ x (* y 0.0692910599291889))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.35e+267) {
tmp = y * 0.08333333333333323;
} else {
tmp = x + (y * 0.0692910599291889);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.35d+267)) then
tmp = y * 0.08333333333333323d0
else
tmp = x + (y * 0.0692910599291889d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.35e+267) {
tmp = y * 0.08333333333333323;
} else {
tmp = x + (y * 0.0692910599291889);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.35e+267: tmp = y * 0.08333333333333323 else: tmp = x + (y * 0.0692910599291889) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.35e+267) tmp = Float64(y * 0.08333333333333323); else tmp = Float64(x + Float64(y * 0.0692910599291889)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.35e+267) tmp = y * 0.08333333333333323; else tmp = x + (y * 0.0692910599291889); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.35e+267], N[(y * 0.08333333333333323), $MachinePrecision], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{+267}:\\
\;\;\;\;y \cdot 0.08333333333333323\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\end{array}
\end{array}
if y < -2.35e267Initial program 88.3%
+-commutative88.3%
*-commutative88.3%
associate-/l*99.2%
fma-define99.2%
*-commutative99.2%
fma-define99.2%
fma-define99.2%
*-commutative99.2%
fma-define99.2%
Simplified99.2%
Taylor expanded in z around 0 90.0%
+-commutative90.0%
Simplified90.0%
Taylor expanded in y around inf 90.0%
if -2.35e267 < y Initial program 69.2%
+-commutative69.2%
*-commutative69.2%
associate-/l*73.9%
fma-define73.9%
*-commutative73.9%
fma-define73.9%
fma-define73.9%
*-commutative73.9%
fma-define73.9%
Simplified73.9%
Taylor expanded in z around inf 82.3%
+-commutative82.3%
Simplified82.3%
Final simplification82.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 69.8%
+-commutative69.8%
*-commutative69.8%
associate-/l*74.7%
fma-define74.7%
*-commutative74.7%
fma-define74.7%
fma-define74.7%
*-commutative74.7%
fma-define74.7%
Simplified74.7%
Taylor expanded in y around 0 53.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(-
(* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y)
(- (/ (* 0.40462203869992125 y) (* z z)) x))))
(if (< z -8120153.652456675)
t_0
(if (< z 6.576118972787377e+20)
(+
x
(*
(*
y
(+
(* (+ (* z 0.0692910599291889) 0.4917317610505968) z)
0.279195317918525))
(/ 1.0 (+ (* (+ z 6.012459259764103) z) 3.350343815022304))))
t_0))))
double code(double x, double y, double z) {
double t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x);
double tmp;
if (z < -8120153.652456675) {
tmp = t_0;
} else if (z < 6.576118972787377e+20) {
tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (((0.07512208616047561d0 / z) + 0.0692910599291889d0) * y) - (((0.40462203869992125d0 * y) / (z * z)) - x)
if (z < (-8120153.652456675d0)) then
tmp = t_0
else if (z < 6.576118972787377d+20) then
tmp = x + ((y * ((((z * 0.0692910599291889d0) + 0.4917317610505968d0) * z) + 0.279195317918525d0)) * (1.0d0 / (((z + 6.012459259764103d0) * z) + 3.350343815022304d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x);
double tmp;
if (z < -8120153.652456675) {
tmp = t_0;
} else if (z < 6.576118972787377e+20) {
tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x) tmp = 0 if z < -8120153.652456675: tmp = t_0 elif z < 6.576118972787377e+20: tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(Float64(0.07512208616047561 / z) + 0.0692910599291889) * y) - Float64(Float64(Float64(0.40462203869992125 * y) / Float64(z * z)) - x)) tmp = 0.0 if (z < -8120153.652456675) tmp = t_0; elseif (z < 6.576118972787377e+20) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * Float64(1.0 / Float64(Float64(Float64(z + 6.012459259764103) * z) + 3.350343815022304)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (((0.07512208616047561 / z) + 0.0692910599291889) * y) - (((0.40462203869992125 * y) / (z * z)) - x); tmp = 0.0; if (z < -8120153.652456675) tmp = t_0; elseif (z < 6.576118972787377e+20) tmp = x + ((y * ((((z * 0.0692910599291889) + 0.4917317610505968) * z) + 0.279195317918525)) * (1.0 / (((z + 6.012459259764103) * z) + 3.350343815022304))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(N[(0.07512208616047561 / z), $MachinePrecision] + 0.0692910599291889), $MachinePrecision] * y), $MachinePrecision] - N[(N[(N[(0.40462203869992125 * y), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -8120153.652456675], t$95$0, If[Less[z, 6.576118972787377e+20], N[(x + N[(N[(y * N[(N[(N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision] * z), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(N[(z + 6.012459259764103), $MachinePrecision] * z), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{0.07512208616047561}{z} + 0.0692910599291889\right) \cdot y - \left(\frac{0.40462203869992125 \cdot y}{z \cdot z} - x\right)\\
\mathbf{if}\;z < -8120153.652456675:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z < 6.576118972787377 \cdot 10^{+20}:\\
\;\;\;\;x + \left(y \cdot \left(\left(z \cdot 0.0692910599291889 + 0.4917317610505968\right) \cdot z + 0.279195317918525\right)\right) \cdot \frac{1}{\left(z + 6.012459259764103\right) \cdot z + 3.350343815022304}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024106
(FPCore (x y z)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(if (< z -8120153.652456675) (- (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y) (- (/ (* 0.40462203869992125 y) (* z z)) x)) (if (< z 6.576118972787377e+20) (+ x (* (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (/ 1.0 (+ (* (+ z 6.012459259764103) z) 3.350343815022304)))) (- (* (+ (/ 0.07512208616047561 z) 0.0692910599291889) y) (- (/ (* 0.40462203869992125 y) (* z z)) x))))
(+ x (/ (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (+ (* (+ z 6.012459259764103) z) 3.350343815022304))))