
(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 10 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 -62000.0) (not (<= z 4.0)))
(+ x (* y 0.0692910599291889))
(+
x
(*
y
(+
0.08333333333333323
(* z (- (* z 0.0007936505811533442) 0.00277777777751721)))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -62000.0) || !(z <= 4.0)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 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 <= (-62000.0d0)) .or. (.not. (z <= 4.0d0))) then
tmp = x + (y * 0.0692910599291889d0)
else
tmp = x + (y * (0.08333333333333323d0 + (z * ((z * 0.0007936505811533442d0) - 0.00277777777751721d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -62000.0) || !(z <= 4.0)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -62000.0) or not (z <= 4.0): tmp = x + (y * 0.0692910599291889) else: tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721)))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -62000.0) || !(z <= 4.0)) tmp = Float64(x + Float64(y * 0.0692910599291889)); else tmp = Float64(x + Float64(y * Float64(0.08333333333333323 + Float64(z * Float64(Float64(z * 0.0007936505811533442) - 0.00277777777751721))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -62000.0) || ~((z <= 4.0))) tmp = x + (y * 0.0692910599291889); else tmp = x + (y * (0.08333333333333323 + (z * ((z * 0.0007936505811533442) - 0.00277777777751721)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -62000.0], N[Not[LessEqual[z, 4.0]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(0.08333333333333323 + N[(z * N[(N[(z * 0.0007936505811533442), $MachinePrecision] - 0.00277777777751721), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -62000 \lor \neg \left(z \leq 4\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot \left(z \cdot 0.0007936505811533442 - 0.00277777777751721\right)\right)\\
\end{array}
\end{array}
if z < -62000 or 4 < z Initial program 34.0%
+-commutative34.0%
associate-/l*42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
Simplified42.9%
Taylor expanded in z around inf 99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
if -62000 < z < 4Initial program 99.7%
remove-double-neg99.7%
distribute-lft-neg-out99.7%
distribute-neg-frac99.7%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (<=
(/
(*
y
(+
0.279195317918525
(* z (+ 0.4917317610505968 (* z 0.0692910599291889)))))
(+ (* z (+ z 6.012459259764103)) 3.350343815022304))
1e+306)
(fma
y
(/
(fma z (fma z 0.0692910599291889 0.4917317610505968) 0.279195317918525)
(fma z (+ z 6.012459259764103) 3.350343815022304))
x)
(+ x (* y 0.0692910599291889))))
double code(double x, double y, double z) {
double tmp;
if (((y * (0.279195317918525 + (z * (0.4917317610505968 + (z * 0.0692910599291889))))) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) <= 1e+306) {
tmp = fma(y, (fma(z, fma(z, 0.0692910599291889, 0.4917317610505968), 0.279195317918525) / fma(z, (z + 6.012459259764103), 3.350343815022304)), x);
} else {
tmp = x + (y * 0.0692910599291889);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(y * Float64(0.279195317918525 + Float64(z * Float64(0.4917317610505968 + Float64(z * 0.0692910599291889))))) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) <= 1e+306) tmp = fma(y, Float64(fma(z, fma(z, 0.0692910599291889, 0.4917317610505968), 0.279195317918525) / fma(z, Float64(z + 6.012459259764103), 3.350343815022304)), x); else tmp = Float64(x + Float64(y * 0.0692910599291889)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(y * N[(0.279195317918525 + N[(z * N[(0.4917317610505968 + N[(z * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision], 1e+306], N[(y * N[(N[(z * N[(z * 0.0692910599291889 + 0.4917317610505968), $MachinePrecision] + 0.279195317918525), $MachinePrecision] / N[(z * N[(z + 6.012459259764103), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(0.279195317918525 + z \cdot \left(0.4917317610505968 + z \cdot 0.0692910599291889\right)\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.0692910599291889, 0.4917317610505968\right), 0.279195317918525\right)}{\mathsf{fma}\left(z, z + 6.012459259764103, 3.350343815022304\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\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))) < 1.00000000000000002e306Initial program 97.3%
+-commutative97.3%
associate-/l*99.9%
fma-define99.9%
*-commutative99.9%
fma-define99.9%
fma-define99.9%
*-commutative99.9%
fma-define99.9%
Simplified99.9%
if 1.00000000000000002e306 < (/.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.6%
+-commutative0.6%
associate-/l*8.4%
fma-define8.4%
*-commutative8.4%
fma-define8.4%
fma-define8.4%
*-commutative8.4%
fma-define8.4%
Simplified8.4%
Taylor expanded in z around inf 99.5%
+-commutative99.5%
*-commutative99.5%
Simplified99.5%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (<=
(/
(*
y
(+
0.279195317918525
(* z (+ 0.4917317610505968 (* z 0.0692910599291889)))))
(+ (* z (+ z 6.012459259764103)) 3.350343815022304))
1e+306)
(+
x
(*
y
(/
(fma (fma z 0.0692910599291889 0.4917317610505968) z 0.279195317918525)
(fma (+ z 6.012459259764103) z 3.350343815022304))))
(+ x (* y 0.0692910599291889))))
double code(double x, double y, double z) {
double tmp;
if (((y * (0.279195317918525 + (z * (0.4917317610505968 + (z * 0.0692910599291889))))) / ((z * (z + 6.012459259764103)) + 3.350343815022304)) <= 1e+306) {
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);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(y * Float64(0.279195317918525 + Float64(z * Float64(0.4917317610505968 + Float64(z * 0.0692910599291889))))) / Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304)) <= 1e+306) 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 * 0.0692910599291889)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(y * N[(0.279195317918525 + N[(z * N[(0.4917317610505968 + N[(z * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]), $MachinePrecision], 1e+306], 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 * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(0.279195317918525 + z \cdot \left(0.4917317610505968 + z \cdot 0.0692910599291889\right)\right)}{z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304} \leq 10^{+306}:\\
\;\;\;\;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 0.0692910599291889\\
\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))) < 1.00000000000000002e306Initial program 97.3%
remove-double-neg97.3%
distribute-lft-neg-out97.3%
distribute-neg-frac97.3%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
remove-double-neg99.9%
Simplified99.9%
if 1.00000000000000002e306 < (/.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.6%
+-commutative0.6%
associate-/l*8.4%
fma-define8.4%
*-commutative8.4%
fma-define8.4%
fma-define8.4%
*-commutative8.4%
fma-define8.4%
Simplified8.4%
Taylor expanded in z around inf 99.5%
+-commutative99.5%
*-commutative99.5%
Simplified99.5%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* z (+ z 6.012459259764103)) 3.350343815022304))
(t_1
(+
0.279195317918525
(* z (+ 0.4917317610505968 (* z 0.0692910599291889))))))
(if (<= (/ (* y t_1) t_0) 1e+306)
(+ x (/ t_1 (/ t_0 y)))
(+ x (* y 0.0692910599291889)))))
double code(double x, double y, double z) {
double t_0 = (z * (z + 6.012459259764103)) + 3.350343815022304;
double t_1 = 0.279195317918525 + (z * (0.4917317610505968 + (z * 0.0692910599291889)));
double tmp;
if (((y * t_1) / t_0) <= 1e+306) {
tmp = x + (t_1 / (t_0 / y));
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (z * (z + 6.012459259764103d0)) + 3.350343815022304d0
t_1 = 0.279195317918525d0 + (z * (0.4917317610505968d0 + (z * 0.0692910599291889d0)))
if (((y * t_1) / t_0) <= 1d+306) then
tmp = x + (t_1 / (t_0 / y))
else
tmp = x + (y * 0.0692910599291889d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * (z + 6.012459259764103)) + 3.350343815022304;
double t_1 = 0.279195317918525 + (z * (0.4917317610505968 + (z * 0.0692910599291889)));
double tmp;
if (((y * t_1) / t_0) <= 1e+306) {
tmp = x + (t_1 / (t_0 / y));
} else {
tmp = x + (y * 0.0692910599291889);
}
return tmp;
}
def code(x, y, z): t_0 = (z * (z + 6.012459259764103)) + 3.350343815022304 t_1 = 0.279195317918525 + (z * (0.4917317610505968 + (z * 0.0692910599291889))) tmp = 0 if ((y * t_1) / t_0) <= 1e+306: tmp = x + (t_1 / (t_0 / y)) else: tmp = x + (y * 0.0692910599291889) return tmp
function code(x, y, z) t_0 = Float64(Float64(z * Float64(z + 6.012459259764103)) + 3.350343815022304) t_1 = Float64(0.279195317918525 + Float64(z * Float64(0.4917317610505968 + Float64(z * 0.0692910599291889)))) tmp = 0.0 if (Float64(Float64(y * t_1) / t_0) <= 1e+306) tmp = Float64(x + Float64(t_1 / Float64(t_0 / y))); else tmp = Float64(x + Float64(y * 0.0692910599291889)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * (z + 6.012459259764103)) + 3.350343815022304; t_1 = 0.279195317918525 + (z * (0.4917317610505968 + (z * 0.0692910599291889))); tmp = 0.0; if (((y * t_1) / t_0) <= 1e+306) tmp = x + (t_1 / (t_0 / y)); else tmp = x + (y * 0.0692910599291889); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[(z + 6.012459259764103), $MachinePrecision]), $MachinePrecision] + 3.350343815022304), $MachinePrecision]}, Block[{t$95$1 = N[(0.279195317918525 + N[(z * N[(0.4917317610505968 + N[(z * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(y * t$95$1), $MachinePrecision] / t$95$0), $MachinePrecision], 1e+306], N[(x + N[(t$95$1 / N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(z + 6.012459259764103\right) + 3.350343815022304\\
t_1 := 0.279195317918525 + z \cdot \left(0.4917317610505968 + z \cdot 0.0692910599291889\right)\\
\mathbf{if}\;\frac{y \cdot t\_1}{t\_0} \leq 10^{+306}:\\
\;\;\;\;x + \frac{t\_1}{\frac{t\_0}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\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))) < 1.00000000000000002e306Initial program 97.3%
remove-double-neg97.3%
distribute-lft-neg-out97.3%
distribute-neg-frac97.3%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
remove-double-neg99.9%
Simplified99.9%
*-commutative99.9%
fma-define99.9%
div-inv99.3%
associate-*l*99.2%
associate-/r/99.4%
*-commutative99.4%
fma-undefine99.4%
un-div-inv99.4%
fma-define99.4%
*-commutative99.4%
fma-undefine99.4%
Applied egg-rr99.4%
Taylor expanded in z around 0 99.4%
fma-undefine99.4%
Applied egg-rr99.4%
if 1.00000000000000002e306 < (/.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.6%
+-commutative0.6%
associate-/l*8.4%
fma-define8.4%
*-commutative8.4%
fma-define8.4%
fma-define8.4%
*-commutative8.4%
fma-define8.4%
Simplified8.4%
Taylor expanded in z around inf 99.5%
+-commutative99.5%
*-commutative99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -62000.0) (not (<= z 5.1))) (+ x (* y 0.0692910599291889)) (+ x (+ (* z (* y -0.00277777777751721)) (* y 0.08333333333333323)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -62000.0) || !(z <= 5.1)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + ((z * (y * -0.00277777777751721)) + (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 <= (-62000.0d0)) .or. (.not. (z <= 5.1d0))) then
tmp = x + (y * 0.0692910599291889d0)
else
tmp = x + ((z * (y * (-0.00277777777751721d0))) + (y * 0.08333333333333323d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -62000.0) || !(z <= 5.1)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + ((z * (y * -0.00277777777751721)) + (y * 0.08333333333333323));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -62000.0) or not (z <= 5.1): tmp = x + (y * 0.0692910599291889) else: tmp = x + ((z * (y * -0.00277777777751721)) + (y * 0.08333333333333323)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -62000.0) || !(z <= 5.1)) tmp = Float64(x + Float64(y * 0.0692910599291889)); else tmp = Float64(x + Float64(Float64(z * Float64(y * -0.00277777777751721)) + Float64(y * 0.08333333333333323))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -62000.0) || ~((z <= 5.1))) tmp = x + (y * 0.0692910599291889); else tmp = x + ((z * (y * -0.00277777777751721)) + (y * 0.08333333333333323)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -62000.0], N[Not[LessEqual[z, 5.1]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * N[(y * -0.00277777777751721), $MachinePrecision]), $MachinePrecision] + N[(y * 0.08333333333333323), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -62000 \lor \neg \left(z \leq 5.1\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x + \left(z \cdot \left(y \cdot -0.00277777777751721\right) + y \cdot 0.08333333333333323\right)\\
\end{array}
\end{array}
if z < -62000 or 5.0999999999999996 < z Initial program 34.0%
+-commutative34.0%
associate-/l*42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
Simplified42.9%
Taylor expanded in z around inf 99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
if -62000 < z < 5.0999999999999996Initial program 99.7%
remove-double-neg99.7%
distribute-lft-neg-out99.7%
distribute-neg-frac99.7%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 99.6%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -62000.0) (not (<= z 5.1))) (+ x (* y 0.0692910599291889)) (+ x (* y (+ 0.08333333333333323 (* z -0.00277777777751721))))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -62000.0) || !(z <= 5.1)) {
tmp = x + (y * 0.0692910599291889);
} 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 <= (-62000.0d0)) .or. (.not. (z <= 5.1d0))) then
tmp = x + (y * 0.0692910599291889d0)
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 <= -62000.0) || !(z <= 5.1)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -62000.0) or not (z <= 5.1): tmp = x + (y * 0.0692910599291889) else: tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721))) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -62000.0) || !(z <= 5.1)) tmp = Float64(x + Float64(y * 0.0692910599291889)); 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 <= -62000.0) || ~((z <= 5.1))) tmp = x + (y * 0.0692910599291889); else tmp = x + (y * (0.08333333333333323 + (z * -0.00277777777751721))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -62000.0], N[Not[LessEqual[z, 5.1]], $MachinePrecision]], N[(x + N[(y * 0.0692910599291889), $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 -62000 \lor \neg \left(z \leq 5.1\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(0.08333333333333323 + z \cdot -0.00277777777751721\right)\\
\end{array}
\end{array}
if z < -62000 or 5.0999999999999996 < z Initial program 34.0%
+-commutative34.0%
associate-/l*42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
Simplified42.9%
Taylor expanded in z around inf 99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
if -62000 < z < 5.0999999999999996Initial program 99.7%
remove-double-neg99.7%
distribute-lft-neg-out99.7%
distribute-neg-frac99.7%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -62000.0) (not (<= z 5.4))) (+ x (* y 0.0692910599291889)) (+ x (* y 0.08333333333333323))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -62000.0) || !(z <= 5.4)) {
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 <= (-62000.0d0)) .or. (.not. (z <= 5.4d0))) 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 <= -62000.0) || !(z <= 5.4)) {
tmp = x + (y * 0.0692910599291889);
} else {
tmp = x + (y * 0.08333333333333323);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -62000.0) or not (z <= 5.4): tmp = x + (y * 0.0692910599291889) else: tmp = x + (y * 0.08333333333333323) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -62000.0) || !(z <= 5.4)) 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 <= -62000.0) || ~((z <= 5.4))) tmp = x + (y * 0.0692910599291889); else tmp = x + (y * 0.08333333333333323); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -62000.0], N[Not[LessEqual[z, 5.4]], $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 -62000 \lor \neg \left(z \leq 5.4\right):\\
\;\;\;\;x + y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot 0.08333333333333323\\
\end{array}
\end{array}
if z < -62000 or 5.4000000000000004 < z Initial program 34.0%
+-commutative34.0%
associate-/l*42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
fma-define42.9%
*-commutative42.9%
fma-define42.9%
Simplified42.9%
Taylor expanded in z around inf 99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
if -62000 < z < 5.4000000000000004Initial program 99.7%
+-commutative99.7%
associate-/l*99.9%
fma-define99.9%
*-commutative99.9%
fma-define99.9%
fma-define99.9%
*-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around 0 98.8%
+-commutative98.8%
*-commutative98.8%
Simplified98.8%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.5e+64) (not (<= y 1.45e+150))) (* y 0.0692910599291889) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.5e+64) || !(y <= 1.45e+150)) {
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 ((y <= (-5.5d+64)) .or. (.not. (y <= 1.45d+150))) 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 ((y <= -5.5e+64) || !(y <= 1.45e+150)) {
tmp = y * 0.0692910599291889;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.5e+64) or not (y <= 1.45e+150): tmp = y * 0.0692910599291889 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.5e+64) || !(y <= 1.45e+150)) tmp = Float64(y * 0.0692910599291889); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.5e+64) || ~((y <= 1.45e+150))) tmp = y * 0.0692910599291889; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.5e+64], N[Not[LessEqual[y, 1.45e+150]], $MachinePrecision]], N[(y * 0.0692910599291889), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+64} \lor \neg \left(y \leq 1.45 \cdot 10^{+150}\right):\\
\;\;\;\;y \cdot 0.0692910599291889\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.4999999999999996e64 or 1.45000000000000005e150 < y Initial program 66.5%
+-commutative66.5%
associate-/l*78.7%
fma-define78.7%
*-commutative78.7%
fma-define78.7%
fma-define78.7%
*-commutative78.7%
fma-define78.7%
Simplified78.7%
Taylor expanded in z around inf 61.2%
+-commutative61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in y around inf 61.1%
Taylor expanded in x around 0 44.8%
if -5.4999999999999996e64 < y < 1.45000000000000005e150Initial program 72.1%
+-commutative72.1%
associate-/l*72.7%
fma-define72.7%
*-commutative72.7%
fma-define72.7%
fma-define72.7%
*-commutative72.7%
fma-define72.7%
Simplified72.7%
Taylor expanded in y around 0 70.5%
Final simplification62.9%
(FPCore (x y z) :precision binary64 (+ x (* y 0.0692910599291889)))
double code(double x, double y, double z) {
return x + (y * 0.0692910599291889);
}
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 * 0.0692910599291889d0)
end function
public static double code(double x, double y, double z) {
return x + (y * 0.0692910599291889);
}
def code(x, y, z): return x + (y * 0.0692910599291889)
function code(x, y, z) return Float64(x + Float64(y * 0.0692910599291889)) end
function tmp = code(x, y, z) tmp = x + (y * 0.0692910599291889); end
code[x_, y_, z_] := N[(x + N[(y * 0.0692910599291889), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot 0.0692910599291889
\end{array}
Initial program 70.5%
+-commutative70.5%
associate-/l*74.5%
fma-define74.5%
*-commutative74.5%
fma-define74.5%
fma-define74.5%
*-commutative74.5%
fma-define74.5%
Simplified74.5%
Taylor expanded in z around inf 78.2%
+-commutative78.2%
*-commutative78.2%
Simplified78.2%
Final simplification78.2%
(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 70.5%
+-commutative70.5%
associate-/l*74.5%
fma-define74.5%
*-commutative74.5%
fma-define74.5%
fma-define74.5%
*-commutative74.5%
fma-define74.5%
Simplified74.5%
Taylor expanded in y around 0 55.3%
(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 2024145
(FPCore (x y z)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -324806146098267/40000000) (- (* (+ (/ 7512208616047561/100000000000000000 z) 692910599291889/10000000000000000) y) (- (/ (* 323697630959937/800000000000000 y) (* z z)) x)) (if (< z 657611897278737700000) (+ x (* (* y (+ (* (+ (* z 692910599291889/10000000000000000) 307332350656623/625000000000000) z) 11167812716741/40000000000000)) (/ 1 (+ (* (+ z 6012459259764103/1000000000000000) z) 104698244219447/31250000000000)))) (- (* (+ (/ 7512208616047561/100000000000000000 z) 692910599291889/10000000000000000) y) (- (/ (* 323697630959937/800000000000000 y) (* z z)) x)))))
(+ x (/ (* y (+ (* (+ (* z 0.0692910599291889) 0.4917317610505968) z) 0.279195317918525)) (+ (* (+ z 6.012459259764103) z) 3.350343815022304))))