
(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 11 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 (or (<= z -2.75e+14) (not (<= z 5.3e+76))) (* (- y z) (/ 0.5 t)) (/ (+ x y) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.75e+14) || !(z <= 5.3e+76)) {
tmp = (y - z) * (0.5 / t);
} else {
tmp = (x + y) / (t * 2.0);
}
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 <= (-2.75d+14)) .or. (.not. (z <= 5.3d+76))) then
tmp = (y - z) * (0.5d0 / t)
else
tmp = (x + y) / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.75e+14) || !(z <= 5.3e+76)) {
tmp = (y - z) * (0.5 / t);
} else {
tmp = (x + y) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.75e+14) or not (z <= 5.3e+76): tmp = (y - z) * (0.5 / t) else: tmp = (x + y) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.75e+14) || !(z <= 5.3e+76)) tmp = Float64(Float64(y - z) * Float64(0.5 / t)); else tmp = Float64(Float64(x + y) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.75e+14) || ~((z <= 5.3e+76))) tmp = (y - z) * (0.5 / t); else tmp = (x + y) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.75e+14], N[Not[LessEqual[z, 5.3e+76]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+14} \lor \neg \left(z \leq 5.3 \cdot 10^{+76}\right):\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\end{array}
\end{array}
if z < -2.75e14 or 5.30000000000000015e76 < z Initial program 100.0%
Taylor expanded in x around 0 81.7%
*-commutative81.7%
associate-*l/81.7%
associate-*r/81.6%
Simplified81.6%
if -2.75e14 < z < 5.30000000000000015e76Initial program 100.0%
Taylor expanded in z around 0 90.4%
+-commutative90.4%
Simplified90.4%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (<= y -8.5e-275) (/ x (* t 2.0)) (if (<= y 1.6e+41) (/ (* z -0.5) t) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e-275) {
tmp = x / (t * 2.0);
} else if (y <= 1.6e+41) {
tmp = (z * -0.5) / t;
} else {
tmp = y / (t * 2.0);
}
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 <= (-8.5d-275)) then
tmp = x / (t * 2.0d0)
else if (y <= 1.6d+41) then
tmp = (z * (-0.5d0)) / t
else
tmp = y / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e-275) {
tmp = x / (t * 2.0);
} else if (y <= 1.6e+41) {
tmp = (z * -0.5) / t;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.5e-275: tmp = x / (t * 2.0) elif y <= 1.6e+41: tmp = (z * -0.5) / t else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.5e-275) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 1.6e+41) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.5e-275) tmp = x / (t * 2.0); elseif (y <= 1.6e+41) tmp = (z * -0.5) / t; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.5e-275], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+41], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-275}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -8.49999999999999952e-275Initial program 100.0%
Taylor expanded in x around inf 35.1%
if -8.49999999999999952e-275 < y < 1.60000000000000005e41Initial program 100.0%
Taylor expanded in z around inf 50.0%
*-commutative50.0%
associate-*l/50.0%
Simplified50.0%
if 1.60000000000000005e41 < y Initial program 100.0%
Taylor expanded in y around inf 63.3%
(FPCore (x y z t) :precision binary64 (if (<= y -8.5e-275) (/ x (* t 2.0)) (if (<= y 1.35e+38) (* z (/ -0.5 t)) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e-275) {
tmp = x / (t * 2.0);
} else if (y <= 1.35e+38) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (t * 2.0);
}
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 <= (-8.5d-275)) then
tmp = x / (t * 2.0d0)
else if (y <= 1.35d+38) then
tmp = z * ((-0.5d0) / t)
else
tmp = y / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e-275) {
tmp = x / (t * 2.0);
} else if (y <= 1.35e+38) {
tmp = z * (-0.5 / t);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.5e-275: tmp = x / (t * 2.0) elif y <= 1.35e+38: tmp = z * (-0.5 / t) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.5e-275) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 1.35e+38) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.5e-275) tmp = x / (t * 2.0); elseif (y <= 1.35e+38) tmp = z * (-0.5 / t); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.5e-275], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+38], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-275}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+38}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < -8.49999999999999952e-275Initial program 100.0%
Taylor expanded in x around inf 35.1%
if -8.49999999999999952e-275 < y < 1.34999999999999998e38Initial program 100.0%
Taylor expanded in z around inf 50.6%
*-commutative50.6%
associate-*l/50.6%
Simplified50.6%
*-commutative50.6%
associate-*l/50.4%
Applied egg-rr50.4%
if 1.34999999999999998e38 < y Initial program 100.0%
Taylor expanded in y around inf 62.5%
Final simplification47.7%
(FPCore (x y z t) :precision binary64 (if (<= y -8.5e-275) (/ x (* t 2.0)) (if (<= y 9.2e+38) (* z (/ -0.5 t)) (* y (/ 0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e-275) {
tmp = x / (t * 2.0);
} else if (y <= 9.2e+38) {
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 (y <= (-8.5d-275)) then
tmp = x / (t * 2.0d0)
else if (y <= 9.2d+38) 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 (y <= -8.5e-275) {
tmp = x / (t * 2.0);
} else if (y <= 9.2e+38) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.5e-275: tmp = x / (t * 2.0) elif y <= 9.2e+38: tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.5e-275) tmp = Float64(x / Float64(t * 2.0)); elseif (y <= 9.2e+38) 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 (y <= -8.5e-275) tmp = x / (t * 2.0); elseif (y <= 9.2e+38) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.5e-275], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e+38], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-275}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+38}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < -8.49999999999999952e-275Initial program 100.0%
Taylor expanded in x around inf 35.1%
if -8.49999999999999952e-275 < y < 9.2000000000000005e38Initial program 100.0%
Taylor expanded in z around inf 50.0%
*-commutative50.0%
associate-*l/50.0%
Simplified50.0%
*-commutative50.0%
associate-*l/49.9%
Applied egg-rr49.9%
if 9.2000000000000005e38 < y Initial program 100.0%
Taylor expanded in z around inf 89.0%
sub-neg89.0%
associate-*r/89.0%
distribute-rgt-in89.0%
associate-*l/89.0%
associate-*r/89.0%
metadata-eval89.0%
associate-*r/89.0%
associate-*l/89.0%
associate-*r/88.8%
metadata-eval88.8%
associate-*r/88.8%
distribute-rgt-in90.3%
associate-*r/90.3%
metadata-eval90.3%
associate-*l/90.5%
associate-*r/90.5%
+-commutative90.5%
associate-*r/90.5%
metadata-eval90.5%
Simplified90.5%
Taylor expanded in t around 0 80.9%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
associate-*l/63.3%
associate-*r/63.1%
Simplified63.1%
Final simplification47.6%
(FPCore (x y z t) :precision binary64 (if (<= y -8.5e-275) (* x (/ 0.5 t)) (if (<= y 3.1e+40) (* z (/ -0.5 t)) (* y (/ 0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e-275) {
tmp = x * (0.5 / t);
} else if (y <= 3.1e+40) {
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 (y <= (-8.5d-275)) then
tmp = x * (0.5d0 / t)
else if (y <= 3.1d+40) 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 (y <= -8.5e-275) {
tmp = x * (0.5 / t);
} else if (y <= 3.1e+40) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.5e-275: tmp = x * (0.5 / t) elif y <= 3.1e+40: tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.5e-275) tmp = Float64(x * Float64(0.5 / t)); elseif (y <= 3.1e+40) 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 (y <= -8.5e-275) tmp = x * (0.5 / t); elseif (y <= 3.1e+40) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.5e-275], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+40], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-275}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < -8.49999999999999952e-275Initial program 100.0%
Taylor expanded in x around inf 35.1%
clear-num35.0%
associate-/r/35.0%
*-commutative35.0%
associate-/r*35.0%
metadata-eval35.0%
Applied egg-rr35.0%
if -8.49999999999999952e-275 < y < 3.0999999999999998e40Initial program 100.0%
Taylor expanded in z around inf 50.0%
*-commutative50.0%
associate-*l/50.0%
Simplified50.0%
*-commutative50.0%
associate-*l/49.9%
Applied egg-rr49.9%
if 3.0999999999999998e40 < y Initial program 100.0%
Taylor expanded in z around inf 89.0%
sub-neg89.0%
associate-*r/89.0%
distribute-rgt-in89.0%
associate-*l/89.0%
associate-*r/89.0%
metadata-eval89.0%
associate-*r/89.0%
associate-*l/89.0%
associate-*r/88.8%
metadata-eval88.8%
associate-*r/88.8%
distribute-rgt-in90.3%
associate-*r/90.3%
metadata-eval90.3%
associate-*l/90.5%
associate-*r/90.5%
+-commutative90.5%
associate-*r/90.5%
metadata-eval90.5%
Simplified90.5%
Taylor expanded in t around 0 80.9%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
associate-*l/63.3%
associate-*r/63.1%
Simplified63.1%
Final simplification47.5%
(FPCore (x y z t) :precision binary64 (if (<= y 7.8e-81) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.8e-81) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
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 <= 7.8d-81) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (y - z) / (t * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.8e-81) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 7.8e-81: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 7.8e-81) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 7.8e-81) tmp = (x - z) / (t * 2.0); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 7.8e-81], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.8 \cdot 10^{-81}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if y < 7.7999999999999997e-81Initial program 100.0%
Taylor expanded in y around 0 78.7%
if 7.7999999999999997e-81 < y Initial program 100.0%
Taylor expanded in x around 0 85.3%
(FPCore (x y z t) :precision binary64 (if (<= y 8e-84) (/ (- x z) (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e-84) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) * (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 <= 8d-84) then
tmp = (x - z) / (t * 2.0d0)
else
tmp = (y - z) * (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 <= 8e-84) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 8e-84: tmp = (x - z) / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 8e-84) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 8e-84) tmp = (x - z) / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 8e-84], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-84}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 8.0000000000000003e-84Initial program 100.0%
Taylor expanded in y around 0 78.7%
if 8.0000000000000003e-84 < y Initial program 100.0%
Taylor expanded in x around 0 85.3%
*-commutative85.3%
associate-*l/85.3%
associate-*r/85.1%
Simplified85.1%
(FPCore (x y z t) :precision binary64 (if (<= x -1.85e+89) (/ x (* t 2.0)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.85e+89) {
tmp = x / (t * 2.0);
} else {
tmp = (y - z) * (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 <= (-1.85d+89)) then
tmp = x / (t * 2.0d0)
else
tmp = (y - z) * (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 <= -1.85e+89) {
tmp = x / (t * 2.0);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.85e+89: tmp = x / (t * 2.0) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.85e+89) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.85e+89) tmp = x / (t * 2.0); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.85e+89], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+89}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -1.8499999999999999e89Initial program 100.0%
Taylor expanded in x around inf 75.3%
if -1.8499999999999999e89 < x Initial program 100.0%
Taylor expanded in x around 0 78.4%
*-commutative78.4%
associate-*l/78.4%
associate-*r/78.1%
Simplified78.1%
(FPCore (x y z t) :precision binary64 (if (<= y 2.2e+39) (* z (/ -0.5 t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e+39) {
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 (y <= 2.2d+39) 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 (y <= 2.2e+39) {
tmp = z * (-0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.2e+39: tmp = z * (-0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e+39) 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 (y <= 2.2e+39) tmp = z * (-0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.2e+39], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.2 \cdot 10^{+39}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 2.2000000000000001e39Initial program 100.0%
Taylor expanded in z around inf 44.6%
*-commutative44.6%
associate-*l/44.6%
Simplified44.6%
*-commutative44.6%
associate-*l/44.5%
Applied egg-rr44.5%
if 2.2000000000000001e39 < y Initial program 100.0%
Taylor expanded in z around inf 89.0%
sub-neg89.0%
associate-*r/89.0%
distribute-rgt-in89.0%
associate-*l/89.0%
associate-*r/89.0%
metadata-eval89.0%
associate-*r/89.0%
associate-*l/89.0%
associate-*r/88.8%
metadata-eval88.8%
associate-*r/88.8%
distribute-rgt-in90.3%
associate-*r/90.3%
metadata-eval90.3%
associate-*l/90.5%
associate-*r/90.5%
+-commutative90.5%
associate-*r/90.5%
metadata-eval90.5%
Simplified90.5%
Taylor expanded in t around 0 80.9%
Taylor expanded in y around inf 63.3%
*-commutative63.3%
associate-*l/63.3%
associate-*r/63.1%
Simplified63.1%
Final simplification49.7%
(FPCore (x y z t) :precision binary64 (* y (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return y * (0.5 / 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 = y * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return y * (0.5 / t);
}
def code(x, y, z, t): return y * (0.5 / t)
function code(x, y, z, t) return Float64(y * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = y * (0.5 / t); end
code[x_, y_, z_, t_] := N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in z around inf 91.0%
sub-neg91.0%
associate-*r/91.0%
distribute-rgt-in91.0%
associate-*l/91.0%
associate-*r/90.9%
metadata-eval90.9%
associate-*r/90.9%
associate-*l/90.9%
associate-*r/90.8%
metadata-eval90.8%
associate-*r/90.8%
distribute-rgt-in91.2%
associate-*r/91.2%
metadata-eval91.2%
associate-*l/91.4%
associate-*r/91.4%
+-commutative91.4%
associate-*r/91.4%
metadata-eval91.4%
Simplified91.4%
Taylor expanded in t around 0 84.1%
Taylor expanded in y around inf 37.2%
*-commutative37.2%
associate-*l/37.2%
associate-*r/37.0%
Simplified37.0%
herbie shell --seed 2024181
(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)))