
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -6.2)
(* 0.5 (/ x t))
(if (or (<= x -4.4e-160) (and (not (<= x -3.4e-178)) (<= x -4.3e-243)))
(* z (/ -0.5 t))
(* y (/ 0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2) {
tmp = 0.5 * (x / t);
} else if ((x <= -4.4e-160) || (!(x <= -3.4e-178) && (x <= -4.3e-243))) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-6.2d0)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-4.4d-160)) .or. (.not. (x <= (-3.4d-178))) .and. (x <= (-4.3d-243))) then
tmp = z * ((-0.5d0) / t)
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2) {
tmp = 0.5 * (x / t);
} else if ((x <= -4.4e-160) || (!(x <= -3.4e-178) && (x <= -4.3e-243))) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2: tmp = 0.5 * (x / t) elif (x <= -4.4e-160) or (not (x <= -3.4e-178) and (x <= -4.3e-243)): tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -4.4e-160) || (!(x <= -3.4e-178) && (x <= -4.3e-243))) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.2) tmp = 0.5 * (x / t); elseif ((x <= -4.4e-160) || (~((x <= -3.4e-178)) && (x <= -4.3e-243))) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4.4e-160], And[N[Not[LessEqual[x, -3.4e-178]], $MachinePrecision], LessEqual[x, -4.3e-243]]], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-160} \lor \neg \left(x \leq -3.4 \cdot 10^{-178}\right) \land x \leq -4.3 \cdot 10^{-243}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -6.20000000000000018Initial program 99.9%
Taylor expanded in x around inf 64.0%
if -6.20000000000000018 < x < -4.4e-160 or -3.39999999999999973e-178 < x < -4.3e-243Initial program 100.0%
Taylor expanded in z around inf 58.1%
*-commutative58.1%
associate-*l/58.1%
associate-*r/58.0%
Simplified58.0%
if -4.4e-160 < x < -3.39999999999999973e-178 or -4.3e-243 < x Initial program 100.0%
Taylor expanded in x around 0 96.3%
associate-*r/96.3%
associate-*l/96.2%
associate-*r/96.2%
associate-*l/96.0%
distribute-lft-in99.7%
associate-+r-99.7%
+-commutative99.7%
associate--l+99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 40.9%
associate-*r/40.9%
*-commutative40.9%
associate-*r/40.8%
Simplified40.8%
Final simplification50.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* z -0.5) t)))
(if (<= x -6.0)
(* 0.5 (/ x t))
(if (<= x -2.3e-161)
t_1
(if (<= x -5.2e-177)
(* y (/ 0.5 t))
(if (<= x -1.3e-243) t_1 (/ (* y 0.5) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * -0.5) / t;
double tmp;
if (x <= -6.0) {
tmp = 0.5 * (x / t);
} else if (x <= -2.3e-161) {
tmp = t_1;
} else if (x <= -5.2e-177) {
tmp = y * (0.5 / t);
} else if (x <= -1.3e-243) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (z * (-0.5d0)) / t
if (x <= (-6.0d0)) then
tmp = 0.5d0 * (x / t)
else if (x <= (-2.3d-161)) then
tmp = t_1
else if (x <= (-5.2d-177)) then
tmp = y * (0.5d0 / t)
else if (x <= (-1.3d-243)) then
tmp = t_1
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * -0.5) / t;
double tmp;
if (x <= -6.0) {
tmp = 0.5 * (x / t);
} else if (x <= -2.3e-161) {
tmp = t_1;
} else if (x <= -5.2e-177) {
tmp = y * (0.5 / t);
} else if (x <= -1.3e-243) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * -0.5) / t tmp = 0 if x <= -6.0: tmp = 0.5 * (x / t) elif x <= -2.3e-161: tmp = t_1 elif x <= -5.2e-177: tmp = y * (0.5 / t) elif x <= -1.3e-243: tmp = t_1 else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * -0.5) / t) tmp = 0.0 if (x <= -6.0) tmp = Float64(0.5 * Float64(x / t)); elseif (x <= -2.3e-161) tmp = t_1; elseif (x <= -5.2e-177) tmp = Float64(y * Float64(0.5 / t)); elseif (x <= -1.3e-243) tmp = t_1; else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * -0.5) / t; tmp = 0.0; if (x <= -6.0) tmp = 0.5 * (x / t); elseif (x <= -2.3e-161) tmp = t_1; elseif (x <= -5.2e-177) tmp = y * (0.5 / t); elseif (x <= -1.3e-243) tmp = t_1; else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[x, -6.0], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.3e-161], t$95$1, If[LessEqual[x, -5.2e-177], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e-243], t$95$1, N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot -0.5}{t}\\
\mathbf{if}\;x \leq -6:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-177}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-243}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if x < -6Initial program 99.9%
Taylor expanded in x around inf 64.0%
if -6 < x < -2.3e-161 or -5.2000000000000002e-177 < x < -1.2999999999999999e-243Initial program 100.0%
Taylor expanded in z around inf 58.1%
*-commutative58.1%
associate-*l/58.1%
Simplified58.1%
if -2.3e-161 < x < -5.2000000000000002e-177Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
associate-*l/100.0%
associate-*r/100.0%
associate-*l/99.7%
distribute-lft-in99.7%
associate-+r-99.7%
+-commutative99.7%
associate--l+99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 86.0%
associate-*r/86.0%
*-commutative86.0%
associate-*r/86.0%
Simplified86.0%
if -1.2999999999999999e-243 < x Initial program 100.0%
Taylor expanded in y around inf 38.9%
associate-*r/38.9%
Simplified38.9%
Final simplification50.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ -0.5 t))))
(if (<= x -12.0)
(* 0.5 (/ x t))
(if (<= x -5.2e-161)
t_1
(if (<= x -2.5e-178)
(* y (/ 0.5 t))
(if (<= x -1.5e-242) t_1 (/ (* y 0.5) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (-0.5 / t);
double tmp;
if (x <= -12.0) {
tmp = 0.5 * (x / t);
} else if (x <= -5.2e-161) {
tmp = t_1;
} else if (x <= -2.5e-178) {
tmp = y * (0.5 / t);
} else if (x <= -1.5e-242) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * ((-0.5d0) / t)
if (x <= (-12.0d0)) then
tmp = 0.5d0 * (x / t)
else if (x <= (-5.2d-161)) then
tmp = t_1
else if (x <= (-2.5d-178)) then
tmp = y * (0.5d0 / t)
else if (x <= (-1.5d-242)) then
tmp = t_1
else
tmp = (y * 0.5d0) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (-0.5 / t);
double tmp;
if (x <= -12.0) {
tmp = 0.5 * (x / t);
} else if (x <= -5.2e-161) {
tmp = t_1;
} else if (x <= -2.5e-178) {
tmp = y * (0.5 / t);
} else if (x <= -1.5e-242) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (-0.5 / t) tmp = 0 if x <= -12.0: tmp = 0.5 * (x / t) elif x <= -5.2e-161: tmp = t_1 elif x <= -2.5e-178: tmp = y * (0.5 / t) elif x <= -1.5e-242: tmp = t_1 else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-0.5 / t)) tmp = 0.0 if (x <= -12.0) tmp = Float64(0.5 * Float64(x / t)); elseif (x <= -5.2e-161) tmp = t_1; elseif (x <= -2.5e-178) tmp = Float64(y * Float64(0.5 / t)); elseif (x <= -1.5e-242) tmp = t_1; else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (-0.5 / t); tmp = 0.0; if (x <= -12.0) tmp = 0.5 * (x / t); elseif (x <= -5.2e-161) tmp = t_1; elseif (x <= -2.5e-178) tmp = y * (0.5 / t); elseif (x <= -1.5e-242) tmp = t_1; else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -12.0], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.2e-161], t$95$1, If[LessEqual[x, -2.5e-178], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.5e-242], t$95$1, N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-0.5}{t}\\
\mathbf{if}\;x \leq -12:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-178}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-242}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if x < -12Initial program 99.9%
Taylor expanded in x around inf 64.0%
if -12 < x < -5.19999999999999991e-161 or -2.49999999999999988e-178 < x < -1.5e-242Initial program 100.0%
Taylor expanded in z around inf 58.1%
*-commutative58.1%
associate-*l/58.1%
associate-*r/58.0%
Simplified58.0%
if -5.19999999999999991e-161 < x < -2.49999999999999988e-178Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
associate-*l/100.0%
associate-*r/100.0%
associate-*l/99.7%
distribute-lft-in99.7%
associate-+r-99.7%
+-commutative99.7%
associate--l+99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 86.0%
associate-*r/86.0%
*-commutative86.0%
associate-*r/86.0%
Simplified86.0%
if -1.5e-242 < x Initial program 100.0%
Taylor expanded in y around inf 38.9%
associate-*r/38.9%
Simplified38.9%
Final simplification50.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ (- x z) t))))
(if (<= x -3.7e+124)
t_1
(if (<= x -2.4e+78)
(* 0.5 (+ (/ y t) (/ x t)))
(if (<= x -4.2e-87) t_1 (/ (* 0.5 (- y z)) t))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (x <= -3.7e+124) {
tmp = t_1;
} else if (x <= -2.4e+78) {
tmp = 0.5 * ((y / t) + (x / t));
} else if (x <= -4.2e-87) {
tmp = t_1;
} else {
tmp = (0.5 * (y - z)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * ((x - z) / t)
if (x <= (-3.7d+124)) then
tmp = t_1
else if (x <= (-2.4d+78)) then
tmp = 0.5d0 * ((y / t) + (x / t))
else if (x <= (-4.2d-87)) then
tmp = t_1
else
tmp = (0.5d0 * (y - z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (x <= -3.7e+124) {
tmp = t_1;
} else if (x <= -2.4e+78) {
tmp = 0.5 * ((y / t) + (x / t));
} else if (x <= -4.2e-87) {
tmp = t_1;
} else {
tmp = (0.5 * (y - z)) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * ((x - z) / t) tmp = 0 if x <= -3.7e+124: tmp = t_1 elif x <= -2.4e+78: tmp = 0.5 * ((y / t) + (x / t)) elif x <= -4.2e-87: tmp = t_1 else: tmp = (0.5 * (y - z)) / t return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(Float64(x - z) / t)) tmp = 0.0 if (x <= -3.7e+124) tmp = t_1; elseif (x <= -2.4e+78) tmp = Float64(0.5 * Float64(Float64(y / t) + Float64(x / t))); elseif (x <= -4.2e-87) tmp = t_1; else tmp = Float64(Float64(0.5 * Float64(y - z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * ((x - z) / t); tmp = 0.0; if (x <= -3.7e+124) tmp = t_1; elseif (x <= -2.4e+78) tmp = 0.5 * ((y / t) + (x / t)); elseif (x <= -4.2e-87) tmp = t_1; else tmp = (0.5 * (y - z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.7e+124], t$95$1, If[LessEqual[x, -2.4e+78], N[(0.5 * N[(N[(y / t), $MachinePrecision] + N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.2e-87], t$95$1, N[(N[(0.5 * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x - z}{t}\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{+78}:\\
\;\;\;\;0.5 \cdot \left(\frac{y}{t} + \frac{x}{t}\right)\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y - z\right)}{t}\\
\end{array}
\end{array}
if x < -3.70000000000000008e124 or -2.3999999999999999e78 < x < -4.20000000000000014e-87Initial program 100.0%
Taylor expanded in y around 0 83.0%
if -3.70000000000000008e124 < x < -2.3999999999999999e78Initial program 99.9%
Taylor expanded in z around 0 99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
if -4.20000000000000014e-87 < x Initial program 100.0%
Taylor expanded in x around 0 77.6%
associate-*r/77.6%
Simplified77.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ (- x z) t))))
(if (<= x -5.4e+124)
t_1
(if (<= x -1.05e+77)
(* 0.5 (/ (+ x y) t))
(if (<= x -3.4e-87) t_1 (/ (* 0.5 (- y z)) t))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (x <= -5.4e+124) {
tmp = t_1;
} else if (x <= -1.05e+77) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -3.4e-87) {
tmp = t_1;
} else {
tmp = (0.5 * (y - z)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * ((x - z) / t)
if (x <= (-5.4d+124)) then
tmp = t_1
else if (x <= (-1.05d+77)) then
tmp = 0.5d0 * ((x + y) / t)
else if (x <= (-3.4d-87)) then
tmp = t_1
else
tmp = (0.5d0 * (y - z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (x <= -5.4e+124) {
tmp = t_1;
} else if (x <= -1.05e+77) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -3.4e-87) {
tmp = t_1;
} else {
tmp = (0.5 * (y - z)) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * ((x - z) / t) tmp = 0 if x <= -5.4e+124: tmp = t_1 elif x <= -1.05e+77: tmp = 0.5 * ((x + y) / t) elif x <= -3.4e-87: tmp = t_1 else: tmp = (0.5 * (y - z)) / t return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(Float64(x - z) / t)) tmp = 0.0 if (x <= -5.4e+124) tmp = t_1; elseif (x <= -1.05e+77) tmp = Float64(0.5 * Float64(Float64(x + y) / t)); elseif (x <= -3.4e-87) tmp = t_1; else tmp = Float64(Float64(0.5 * Float64(y - z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * ((x - z) / t); tmp = 0.0; if (x <= -5.4e+124) tmp = t_1; elseif (x <= -1.05e+77) tmp = 0.5 * ((x + y) / t); elseif (x <= -3.4e-87) tmp = t_1; else tmp = (0.5 * (y - z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.4e+124], t$95$1, If[LessEqual[x, -1.05e+77], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.4e-87], t$95$1, N[(N[(0.5 * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x - z}{t}\\
\mathbf{if}\;x \leq -5.4 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \left(y - z\right)}{t}\\
\end{array}
\end{array}
if x < -5.39999999999999956e124 or -1.0499999999999999e77 < x < -3.3999999999999999e-87Initial program 100.0%
Taylor expanded in y around 0 83.0%
if -5.39999999999999956e124 < x < -1.0499999999999999e77Initial program 99.9%
Taylor expanded in z around 0 99.9%
+-commutative99.9%
Simplified99.9%
if -3.3999999999999999e-87 < x Initial program 100.0%
Taylor expanded in x around 0 77.6%
associate-*r/77.6%
Simplified77.6%
Final simplification80.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ (- x z) t))))
(if (<= x -6.2e+124)
t_1
(if (<= x -1.95e+77)
(* 0.5 (/ (+ x y) t))
(if (<= x -4.2e-87) t_1 (* (/ 0.5 t) (- y z)))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (x <= -6.2e+124) {
tmp = t_1;
} else if (x <= -1.95e+77) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -4.2e-87) {
tmp = t_1;
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * ((x - z) / t)
if (x <= (-6.2d+124)) then
tmp = t_1
else if (x <= (-1.95d+77)) then
tmp = 0.5d0 * ((x + y) / t)
else if (x <= (-4.2d-87)) then
tmp = t_1
else
tmp = (0.5d0 / t) * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (x <= -6.2e+124) {
tmp = t_1;
} else if (x <= -1.95e+77) {
tmp = 0.5 * ((x + y) / t);
} else if (x <= -4.2e-87) {
tmp = t_1;
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * ((x - z) / t) tmp = 0 if x <= -6.2e+124: tmp = t_1 elif x <= -1.95e+77: tmp = 0.5 * ((x + y) / t) elif x <= -4.2e-87: tmp = t_1 else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(Float64(x - z) / t)) tmp = 0.0 if (x <= -6.2e+124) tmp = t_1; elseif (x <= -1.95e+77) tmp = Float64(0.5 * Float64(Float64(x + y) / t)); elseif (x <= -4.2e-87) tmp = t_1; else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * ((x - z) / t); tmp = 0.0; if (x <= -6.2e+124) tmp = t_1; elseif (x <= -1.95e+77) tmp = 0.5 * ((x + y) / t); elseif (x <= -4.2e-87) tmp = t_1; else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e+124], t$95$1, If[LessEqual[x, -1.95e+77], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.2e-87], t$95$1, N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x - z}{t}\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.95 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -6.2000000000000004e124 or -1.9499999999999999e77 < x < -4.20000000000000014e-87Initial program 100.0%
Taylor expanded in y around 0 83.0%
if -6.2000000000000004e124 < x < -1.9499999999999999e77Initial program 99.9%
Taylor expanded in z around 0 99.9%
+-commutative99.9%
Simplified99.9%
if -4.20000000000000014e-87 < x Initial program 100.0%
Taylor expanded in x around 0 77.6%
*-commutative77.6%
associate-*l/77.6%
associate-*r/77.3%
Simplified77.3%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e+130) (not (<= z 2.3e+19))) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e+130) || !(z <= 2.3e+19)) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.75d+130)) .or. (.not. (z <= 2.3d+19))) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e+130) || !(z <= 2.3e+19)) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e+130) or not (z <= 2.3e+19): tmp = 0.5 * ((x - z) / t) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e+130) || !(z <= 2.3e+19)) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.75e+130) || ~((z <= 2.3e+19))) tmp = 0.5 * ((x - z) / t); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e+130], N[Not[LessEqual[z, 2.3e+19]], $MachinePrecision]], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+130} \lor \neg \left(z \leq 2.3 \cdot 10^{+19}\right):\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -1.75e130 or 2.3e19 < z Initial program 99.9%
Taylor expanded in y around 0 84.2%
if -1.75e130 < z < 2.3e19Initial program 100.0%
Taylor expanded in z around 0 89.0%
+-commutative89.0%
Simplified89.0%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+147) (not (<= z 9e+153))) (/ (* z -0.5) t) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+147) || !(z <= 9e+153)) {
tmp = (z * -0.5) / t;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.3d+147)) .or. (.not. (z <= 9d+153))) then
tmp = (z * (-0.5d0)) / t
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+147) || !(z <= 9e+153)) {
tmp = (z * -0.5) / t;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+147) or not (z <= 9e+153): tmp = (z * -0.5) / t else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+147) || !(z <= 9e+153)) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e+147) || ~((z <= 9e+153))) tmp = (z * -0.5) / t; else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+147], N[Not[LessEqual[z, 9e+153]], $MachinePrecision]], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+147} \lor \neg \left(z \leq 9 \cdot 10^{+153}\right):\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -1.2999999999999999e147 or 9.0000000000000002e153 < z Initial program 99.9%
Taylor expanded in z around inf 78.8%
*-commutative78.8%
associate-*l/78.8%
Simplified78.8%
if -1.2999999999999999e147 < z < 9.0000000000000002e153Initial program 100.0%
Taylor expanded in z around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification83.7%
(FPCore (x y z t) :precision binary64 (if (<= y 1.02e-109) (* 0.5 (/ x t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.02e-109) {
tmp = 0.5 * (x / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 1.02d-109) then
tmp = 0.5d0 * (x / t)
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.02e-109) {
tmp = 0.5 * (x / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.02e-109: tmp = 0.5 * (x / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.02e-109) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.02e-109) tmp = 0.5 * (x / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.02e-109], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.02 \cdot 10^{-109}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 1.02e-109Initial program 100.0%
Taylor expanded in x around inf 44.7%
if 1.02e-109 < y Initial program 100.0%
Taylor expanded in x around 0 97.8%
associate-*r/97.8%
associate-*l/97.8%
associate-*r/97.8%
associate-*l/97.5%
distribute-lft-in99.6%
associate-+r-99.6%
+-commutative99.6%
associate--l+99.6%
Simplified99.6%
associate-*l/100.0%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 52.7%
associate-*r/52.7%
*-commutative52.7%
associate-*r/52.6%
Simplified52.6%
(FPCore (x y z t) :precision binary64 (* (/ 0.5 t) (+ y (- x z))))
double code(double x, double y, double z, double t) {
return (0.5 / t) * (y + (x - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.5d0 / t) * (y + (x - z))
end function
public static double code(double x, double y, double z, double t) {
return (0.5 / t) * (y + (x - z));
}
def code(x, y, z, t): return (0.5 / t) * (y + (x - z))
function code(x, y, z, t) return Float64(Float64(0.5 / t) * Float64(y + Float64(x - z))) end
function tmp = code(x, y, z, t) tmp = (0.5 / t) * (y + (x - z)); end
code[x_, y_, z_, t_] := N[(N[(0.5 / t), $MachinePrecision] * N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(y + \left(x - z\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 96.5%
associate-*r/96.5%
associate-*l/96.3%
associate-*r/96.3%
associate-*l/96.1%
distribute-lft-in99.6%
associate-+r-99.6%
+-commutative99.6%
associate--l+99.6%
Simplified99.6%
(FPCore (x y z t) :precision binary64 (* 0.5 (/ x t)))
double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * (x / t)
end function
public static double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
def code(x, y, z, t): return 0.5 * (x / t)
function code(x, y, z, t) return Float64(0.5 * Float64(x / t)) end
function tmp = code(x, y, z, t) tmp = 0.5 * (x / t); end
code[x_, y_, z_, t_] := N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{x}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 39.8%
herbie shell --seed 2024085
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
:precision binary64
(/ (- (+ x y) z) (* t 2.0)))