
(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 (or (<= z -5.8e+15) (not (<= z 3.7e+14)))
(+ x (/ y 14.431876219268936))
(+
(/
(*
y
(+
(* z (+ (* z 0.0692910599291889) 0.4917317610505968))
0.279195317918525))
(+ (* z (+ z 6.012459259764103)) 3.350343815022304))
x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e+15) || !(z <= 3.7e+14)) {
tmp = x + (y / 14.431876219268936);
} else {
tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + 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 ((z <= (-5.8d+15)) .or. (.not. (z <= 3.7d+14))) then
tmp = x + (y / 14.431876219268936d0)
else
tmp = ((y * ((z * ((z * 0.0692910599291889d0) + 0.4917317610505968d0)) + 0.279195317918525d0)) / ((z * (z + 6.012459259764103d0)) + 3.350343815022304d0)) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e+15) || !(z <= 3.7e+14)) {
tmp = x + (y / 14.431876219268936);
} else {
tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.8e+15) or not (z <= 3.7e+14): tmp = x + (y / 14.431876219268936) else: tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.8e+15) || !(z <= 3.7e+14)) tmp = Float64(x + Float64(y / 14.431876219268936)); else tmp = Float64(Float64(Float64(y * Float64(Float64(z * Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.8e+15) || ~((z <= 3.7e+14))) tmp = x + (y / 14.431876219268936); else tmp = ((y * ((z * ((z * 0.0692910599291889) + 0.4917317610505968)) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.8e+15], N[Not[LessEqual[z, 3.7e+14]], $MachinePrecision]], N[(x + N[(y / 14.431876219268936), $MachinePrecision]), $MachinePrecision], N[(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] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+15} \lor \neg \left(z \leq 3.7 \cdot 10^{+14}\right):\\
\;\;\;\;x + \frac{y}{14.431876219268936}\\
\mathbf{else}:\\
\;\;\;\;\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} + x\\
\end{array}
\end{array}
if z < -5.8e15 or 3.7e14 < z Initial program 24.8%
associate-/l*38.6%
fma-def38.6%
fma-def38.6%
fma-def38.6%
Simplified38.6%
Taylor expanded in z around inf 100.0%
if -5.8e15 < z < 3.7e14Initial program 99.6%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* z 0.0692910599291889) 0.4917317610505968)))
(if (<=
(/
(* y (+ (* z t_0) 0.279195317918525))
(+ (* z (+ z 6.012459259764103)) 3.350343815022304))
2e+305)
(+
x
(/
y
(/
(fma (+ z 6.012459259764103) z 3.350343815022304)
(fma t_0 z 0.279195317918525))))
(+ x (/ y 14.431876219268936)))))
double code(double x, double y, double z) {
double t_0 = (z * 0.0692910599291889) + 0.4917317610505968;
double tmp;
if (((y * ((z * t_0) + 0.279195317918525)) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) <= 2e+305) {
tmp = x + (y / (fma((z + 6.012459259764103), z, 3.350343815022304) / fma(t_0, z, 0.279195317918525)));
} else {
tmp = x + (y / 14.431876219268936);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(z * 0.0692910599291889) + 0.4917317610505968) tmp = 0.0 if (Float64(Float64(y * Float64(Float64(z * t_0) + 0.279195317918525)) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) <= 2e+305) tmp = Float64(x + Float64(y / Float64(fma(Float64(z + 6.012459259764103), z, 3.350343815022304) / fma(t_0, z, 0.279195317918525)))); else tmp = Float64(x + Float64(y / 14.431876219268936)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * 0.0692910599291889), $MachinePrecision] + 0.4917317610505968), $MachinePrecision]}, If[LessEqual[N[(N[(y * N[(N[(z * t$95$0), $MachinePrecision] + 0.279195317918525), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision], 2e+305], N[(x + N[(y / N[(N[(N[(z + 6.012459259764103), $MachinePrecision] * z + 3.350343815022304), $MachinePrecision] / N[(t$95$0 * z + 0.279195317918525), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / 14.431876219268936), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot 0.0692910599291889 + 0.4917317610505968\\
\mathbf{if}\;\frac{y \cdot \left(z \cdot t_0 + 0.279195317918525\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 2 \cdot 10^{+305}:\\
\;\;\;\;x + \frac{y}{\frac{\mathsf{fma}\left(z + 6.012459259764103, z, 3.350343815022304\right)}{\mathsf{fma}\left(t_0, z, 0.279195317918525\right)}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{14.431876219268936}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z 692910599291889/10000000000000000) 307332350656623/625000000000000) z) 11167812716741/40000000000000)) (+.f64 (*.f64 (+.f64 z 6012459259764103/1000000000000000) z) 104698244219447/31250000000000)) < 1.9999999999999999e305Initial program 94.3%
associate-/l*99.4%
fma-def99.4%
fma-def99.4%
fma-def99.4%
Simplified99.4%
fma-def99.4%
Applied egg-rr99.4%
if 1.9999999999999999e305 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 z 692910599291889/10000000000000000) 307332350656623/625000000000000) z) 11167812716741/40000000000000)) (+.f64 (*.f64 (+.f64 z 6012459259764103/1000000000000000) z) 104698244219447/31250000000000)) Initial program 0.5%
associate-/l*9.6%
fma-def9.6%
fma-def9.6%
fma-def9.6%
Simplified9.6%
Taylor expanded in z around inf 100.0%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -6500000.0) (not (<= z 6.1))) (+ x (/ y 14.431876219268936)) (+ x (/ y (+ 12.000000000000014 (* z 0.39999999996247915))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6500000.0) || !(z <= 6.1)) {
tmp = x + (y / 14.431876219268936);
} else {
tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915)));
}
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 <= (-6500000.0d0)) .or. (.not. (z <= 6.1d0))) then
tmp = x + (y / 14.431876219268936d0)
else
tmp = x + (y / (12.000000000000014d0 + (z * 0.39999999996247915d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6500000.0) || !(z <= 6.1)) {
tmp = x + (y / 14.431876219268936);
} else {
tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6500000.0) or not (z <= 6.1): tmp = x + (y / 14.431876219268936) else: tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6500000.0) || !(z <= 6.1)) tmp = Float64(x + Float64(y / 14.431876219268936)); else tmp = Float64(x + Float64(y / Float64(12.000000000000014 + Float64(z * 0.39999999996247915)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6500000.0) || ~((z <= 6.1))) tmp = x + (y / 14.431876219268936); else tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6500000.0], N[Not[LessEqual[z, 6.1]], $MachinePrecision]], N[(x + N[(y / 14.431876219268936), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(12.000000000000014 + N[(z * 0.39999999996247915), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6500000 \lor \neg \left(z \leq 6.1\right):\\
\;\;\;\;x + \frac{y}{14.431876219268936}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{12.000000000000014 + z \cdot 0.39999999996247915}\\
\end{array}
\end{array}
if z < -6.5e6 or 6.0999999999999996 < z Initial program 26.6%
associate-/l*40.1%
fma-def40.1%
fma-def40.1%
fma-def40.1%
Simplified40.1%
Taylor expanded in z around inf 99.2%
if -6.5e6 < z < 6.0999999999999996Initial program 99.6%
associate-/l*99.3%
fma-def99.3%
fma-def99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in z around 0 98.3%
*-commutative98.3%
Simplified98.3%
Final simplification98.7%
(FPCore (x y z)
:precision binary64
(if (<= z -6500000.0)
(+ x (/ y (- 14.431876219268936 (/ 15.646356830292042 z))))
(if (<= z 6.1)
(+ x (/ y (+ 12.000000000000014 (* z 0.39999999996247915))))
(+ x (/ y 14.431876219268936)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6500000.0) {
tmp = x + (y / (14.431876219268936 - (15.646356830292042 / z)));
} else if (z <= 6.1) {
tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915)));
} else {
tmp = x + (y / 14.431876219268936);
}
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 <= (-6500000.0d0)) then
tmp = x + (y / (14.431876219268936d0 - (15.646356830292042d0 / z)))
else if (z <= 6.1d0) then
tmp = x + (y / (12.000000000000014d0 + (z * 0.39999999996247915d0)))
else
tmp = x + (y / 14.431876219268936d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6500000.0) {
tmp = x + (y / (14.431876219268936 - (15.646356830292042 / z)));
} else if (z <= 6.1) {
tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915)));
} else {
tmp = x + (y / 14.431876219268936);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6500000.0: tmp = x + (y / (14.431876219268936 - (15.646356830292042 / z))) elif z <= 6.1: tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915))) else: tmp = x + (y / 14.431876219268936) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6500000.0) tmp = Float64(x + Float64(y / Float64(14.431876219268936 - Float64(15.646356830292042 / z)))); elseif (z <= 6.1) tmp = Float64(x + Float64(y / Float64(12.000000000000014 + Float64(z * 0.39999999996247915)))); else tmp = Float64(x + Float64(y / 14.431876219268936)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6500000.0) tmp = x + (y / (14.431876219268936 - (15.646356830292042 / z))); elseif (z <= 6.1) tmp = x + (y / (12.000000000000014 + (z * 0.39999999996247915))); else tmp = x + (y / 14.431876219268936); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6500000.0], N[(x + N[(y / N[(14.431876219268936 - N[(15.646356830292042 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.1], N[(x + N[(y / N[(12.000000000000014 + N[(z * 0.39999999996247915), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / 14.431876219268936), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6500000:\\
\;\;\;\;x + \frac{y}{14.431876219268936 - \frac{15.646356830292042}{z}}\\
\mathbf{elif}\;z \leq 6.1:\\
\;\;\;\;x + \frac{y}{12.000000000000014 + z \cdot 0.39999999996247915}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{14.431876219268936}\\
\end{array}
\end{array}
if z < -6.5e6Initial program 27.8%
associate-/l*39.2%
fma-def39.2%
fma-def39.2%
fma-def39.2%
Simplified39.2%
Taylor expanded in z around inf 99.9%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
if -6.5e6 < z < 6.0999999999999996Initial program 99.6%
associate-/l*99.3%
fma-def99.3%
fma-def99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in z around 0 98.3%
*-commutative98.3%
Simplified98.3%
if 6.0999999999999996 < z Initial program 25.2%
associate-/l*41.2%
fma-def41.2%
fma-def41.2%
fma-def41.2%
Simplified41.2%
Taylor expanded in z around inf 100.0%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -6500000.0) (not (<= z 5.7))) (+ x (/ y 14.431876219268936)) (+ x (/ y 12.000000000000014))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6500000.0) || !(z <= 5.7)) {
tmp = x + (y / 14.431876219268936);
} else {
tmp = x + (y / 12.000000000000014);
}
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 <= (-6500000.0d0)) .or. (.not. (z <= 5.7d0))) then
tmp = x + (y / 14.431876219268936d0)
else
tmp = x + (y / 12.000000000000014d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6500000.0) || !(z <= 5.7)) {
tmp = x + (y / 14.431876219268936);
} else {
tmp = x + (y / 12.000000000000014);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6500000.0) or not (z <= 5.7): tmp = x + (y / 14.431876219268936) else: tmp = x + (y / 12.000000000000014) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6500000.0) || !(z <= 5.7)) tmp = Float64(x + Float64(y / 14.431876219268936)); else tmp = Float64(x + Float64(y / 12.000000000000014)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6500000.0) || ~((z <= 5.7))) tmp = x + (y / 14.431876219268936); else tmp = x + (y / 12.000000000000014); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6500000.0], N[Not[LessEqual[z, 5.7]], $MachinePrecision]], N[(x + N[(y / 14.431876219268936), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / 12.000000000000014), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6500000 \lor \neg \left(z \leq 5.7\right):\\
\;\;\;\;x + \frac{y}{14.431876219268936}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{12.000000000000014}\\
\end{array}
\end{array}
if z < -6.5e6 or 5.70000000000000018 < z Initial program 26.6%
associate-/l*40.1%
fma-def40.1%
fma-def40.1%
fma-def40.1%
Simplified40.1%
Taylor expanded in z around inf 99.2%
if -6.5e6 < z < 5.70000000000000018Initial program 99.6%
associate-/l*99.3%
fma-def99.3%
fma-def99.3%
fma-def99.3%
Simplified99.3%
Taylor expanded in z around 0 97.5%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= y -1e+20) (* y 0.08333333333333323) (if (<= y 3.3e+16) x (* y 0.08333333333333323))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1e+20) {
tmp = y * 0.08333333333333323;
} else if (y <= 3.3e+16) {
tmp = x;
} else {
tmp = 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 (y <= (-1d+20)) then
tmp = y * 0.08333333333333323d0
else if (y <= 3.3d+16) then
tmp = x
else
tmp = y * 0.08333333333333323d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1e+20) {
tmp = y * 0.08333333333333323;
} else if (y <= 3.3e+16) {
tmp = x;
} else {
tmp = y * 0.08333333333333323;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1e+20: tmp = y * 0.08333333333333323 elif y <= 3.3e+16: tmp = x else: tmp = y * 0.08333333333333323 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1e+20) tmp = Float64(y * 0.08333333333333323); elseif (y <= 3.3e+16) tmp = x; else tmp = Float64(y * 0.08333333333333323); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1e+20) tmp = y * 0.08333333333333323; elseif (y <= 3.3e+16) tmp = x; else tmp = y * 0.08333333333333323; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1e+20], N[(y * 0.08333333333333323), $MachinePrecision], If[LessEqual[y, 3.3e+16], x, N[(y * 0.08333333333333323), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+20}:\\
\;\;\;\;y \cdot 0.08333333333333323\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.08333333333333323\\
\end{array}
\end{array}
if y < -1e20 or 3.3e16 < y Initial program 64.7%
+-commutative64.7%
associate-*l/78.4%
*-commutative78.4%
fma-def78.4%
*-commutative78.4%
fma-def78.4%
fma-def78.4%
*-commutative78.4%
fma-def78.4%
Simplified78.4%
Taylor expanded in z around 0 66.3%
+-commutative66.3%
*-commutative66.3%
fma-def66.3%
Simplified66.3%
Taylor expanded in y around inf 51.8%
if -1e20 < y < 3.3e16Initial program 64.0%
+-commutative64.0%
associate-*l/63.3%
*-commutative63.3%
fma-def63.3%
*-commutative63.3%
fma-def63.3%
fma-def63.3%
*-commutative63.3%
fma-def63.3%
Simplified63.3%
Taylor expanded in y around 0 79.8%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (<= y -1e+20) (* y 0.08333333333333323) (if (<= y 3.5e+17) x (/ y 12.000000000000014))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1e+20) {
tmp = y * 0.08333333333333323;
} else if (y <= 3.5e+17) {
tmp = x;
} else {
tmp = y / 12.000000000000014;
}
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 <= (-1d+20)) then
tmp = y * 0.08333333333333323d0
else if (y <= 3.5d+17) then
tmp = x
else
tmp = y / 12.000000000000014d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1e+20) {
tmp = y * 0.08333333333333323;
} else if (y <= 3.5e+17) {
tmp = x;
} else {
tmp = y / 12.000000000000014;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1e+20: tmp = y * 0.08333333333333323 elif y <= 3.5e+17: tmp = x else: tmp = y / 12.000000000000014 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1e+20) tmp = Float64(y * 0.08333333333333323); elseif (y <= 3.5e+17) tmp = x; else tmp = Float64(y / 12.000000000000014); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1e+20) tmp = y * 0.08333333333333323; elseif (y <= 3.5e+17) tmp = x; else tmp = y / 12.000000000000014; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1e+20], N[(y * 0.08333333333333323), $MachinePrecision], If[LessEqual[y, 3.5e+17], x, N[(y / 12.000000000000014), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+20}:\\
\;\;\;\;y \cdot 0.08333333333333323\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{12.000000000000014}\\
\end{array}
\end{array}
if y < -1e20Initial program 65.3%
+-commutative65.3%
associate-*l/79.1%
*-commutative79.1%
fma-def79.1%
*-commutative79.1%
fma-def79.1%
fma-def79.1%
*-commutative79.1%
fma-def79.1%
Simplified79.1%
Taylor expanded in z around 0 71.3%
+-commutative71.3%
*-commutative71.3%
fma-def71.3%
Simplified71.3%
Taylor expanded in y around inf 55.9%
if -1e20 < y < 3.5e17Initial program 64.0%
+-commutative64.0%
associate-*l/63.3%
*-commutative63.3%
fma-def63.3%
*-commutative63.3%
fma-def63.3%
fma-def63.3%
*-commutative63.3%
fma-def63.3%
Simplified63.3%
Taylor expanded in y around 0 79.8%
if 3.5e17 < y Initial program 63.9%
+-commutative63.9%
associate-*l/77.6%
*-commutative77.6%
fma-def77.6%
*-commutative77.6%
fma-def77.6%
fma-def77.6%
*-commutative77.6%
fma-def77.6%
Simplified77.6%
Taylor expanded in z around 0 61.0%
+-commutative61.0%
*-commutative61.0%
fma-def61.0%
Simplified61.0%
Taylor expanded in y around inf 47.4%
*-commutative47.4%
metadata-eval47.4%
div-inv47.5%
Applied egg-rr47.5%
Final simplification67.4%
(FPCore (x y z) :precision binary64 (+ x (/ y 12.000000000000014)))
double code(double x, double y, double z) {
return x + (y / 12.000000000000014);
}
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 / 12.000000000000014d0)
end function
public static double code(double x, double y, double z) {
return x + (y / 12.000000000000014);
}
def code(x, y, z): return x + (y / 12.000000000000014)
function code(x, y, z) return Float64(x + Float64(y / 12.000000000000014)) end
function tmp = code(x, y, z) tmp = x + (y / 12.000000000000014); end
code[x_, y_, z_] := N[(x + N[(y / 12.000000000000014), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{12.000000000000014}
\end{array}
Initial program 64.3%
associate-/l*70.6%
fma-def70.6%
fma-def70.6%
fma-def70.6%
Simplified70.6%
Taylor expanded in z around 0 80.6%
Final simplification80.6%
(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 64.3%
+-commutative64.3%
associate-*l/70.1%
*-commutative70.1%
fma-def70.1%
*-commutative70.1%
fma-def70.1%
fma-def70.1%
*-commutative70.1%
fma-def70.1%
Simplified70.1%
Taylor expanded in y around 0 51.1%
Final simplification51.1%
(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 2023290
(FPCore (x y z)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(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))))