
(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%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y 1.22e+46) (and (not (<= y 4.4e+86)) (<= y 7.8e+97))) (* 0.5 (/ (- x z) t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= 1.22e+46) || (!(y <= 4.4e+86) && (y <= 7.8e+97))) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * (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 ((y <= 1.22d+46) .or. (.not. (y <= 4.4d+86)) .and. (y <= 7.8d+97)) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= 1.22e+46) || (!(y <= 4.4e+86) && (y <= 7.8e+97))) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= 1.22e+46) or (not (y <= 4.4e+86) and (y <= 7.8e+97)): tmp = 0.5 * ((x - z) / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= 1.22e+46) || (!(y <= 4.4e+86) && (y <= 7.8e+97))) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= 1.22e+46) || (~((y <= 4.4e+86)) && (y <= 7.8e+97))) tmp = 0.5 * ((x - z) / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, 1.22e+46], And[N[Not[LessEqual[y, 4.4e+86]], $MachinePrecision], LessEqual[y, 7.8e+97]]], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.22 \cdot 10^{+46} \lor \neg \left(y \leq 4.4 \cdot 10^{+86}\right) \land y \leq 7.8 \cdot 10^{+97}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 1.22e46 or 4.40000000000000006e86 < y < 7.7999999999999999e97Initial program 100.0%
Taylor expanded in y around 0 72.1%
if 1.22e46 < y < 4.40000000000000006e86 or 7.7999999999999999e97 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 71.6%
Final simplification72.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -9.5e+95)
(* x (/ 0.5 t))
(if (or (<= x -3.8e-49) (not (<= x 1.55e-288)))
(* 0.5 (/ y t))
(/ -0.5 (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e+95) {
tmp = x * (0.5 / t);
} else if ((x <= -3.8e-49) || !(x <= 1.55e-288)) {
tmp = 0.5 * (y / t);
} else {
tmp = -0.5 / (t / 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) :: tmp
if (x <= (-9.5d+95)) then
tmp = x * (0.5d0 / t)
else if ((x <= (-3.8d-49)) .or. (.not. (x <= 1.55d-288))) then
tmp = 0.5d0 * (y / t)
else
tmp = (-0.5d0) / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e+95) {
tmp = x * (0.5 / t);
} else if ((x <= -3.8e-49) || !(x <= 1.55e-288)) {
tmp = 0.5 * (y / t);
} else {
tmp = -0.5 / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.5e+95: tmp = x * (0.5 / t) elif (x <= -3.8e-49) or not (x <= 1.55e-288): tmp = 0.5 * (y / t) else: tmp = -0.5 / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.5e+95) tmp = Float64(x * Float64(0.5 / t)); elseif ((x <= -3.8e-49) || !(x <= 1.55e-288)) tmp = Float64(0.5 * Float64(y / t)); else tmp = Float64(-0.5 / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -9.5e+95) tmp = x * (0.5 / t); elseif ((x <= -3.8e-49) || ~((x <= 1.55e-288))) tmp = 0.5 * (y / t); else tmp = -0.5 / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e+95], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -3.8e-49], N[Not[LessEqual[x, 1.55e-288]], $MachinePrecision]], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+95}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-49} \lor \neg \left(x \leq 1.55 \cdot 10^{-288}\right):\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -9.5000000000000004e95Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 70.6%
*-commutative70.6%
associate-*l/70.6%
associate-*r/70.4%
Simplified70.4%
if -9.5000000000000004e95 < x < -3.7999999999999997e-49 or 1.54999999999999992e-288 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 41.7%
if -3.7999999999999997e-49 < x < 1.54999999999999992e-288Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-*l/100.0%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 46.4%
Final simplification48.4%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.65e+96)
(* x (/ 0.5 t))
(if (or (<= x -6.6e-49) (not (<= x 4.5e-288)))
(* 0.5 (/ y t))
(/ z (/ t -0.5)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e+96) {
tmp = x * (0.5 / t);
} else if ((x <= -6.6e-49) || !(x <= 4.5e-288)) {
tmp = 0.5 * (y / t);
} else {
tmp = z / (t / -0.5);
}
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.65d+96)) then
tmp = x * (0.5d0 / t)
else if ((x <= (-6.6d-49)) .or. (.not. (x <= 4.5d-288))) then
tmp = 0.5d0 * (y / t)
else
tmp = z / (t / (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e+96) {
tmp = x * (0.5 / t);
} else if ((x <= -6.6e-49) || !(x <= 4.5e-288)) {
tmp = 0.5 * (y / t);
} else {
tmp = z / (t / -0.5);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e+96: tmp = x * (0.5 / t) elif (x <= -6.6e-49) or not (x <= 4.5e-288): tmp = 0.5 * (y / t) else: tmp = z / (t / -0.5) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e+96) tmp = Float64(x * Float64(0.5 / t)); elseif ((x <= -6.6e-49) || !(x <= 4.5e-288)) tmp = Float64(0.5 * Float64(y / t)); else tmp = Float64(z / Float64(t / -0.5)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.65e+96) tmp = x * (0.5 / t); elseif ((x <= -6.6e-49) || ~((x <= 4.5e-288))) tmp = 0.5 * (y / t); else tmp = z / (t / -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e+96], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -6.6e-49], N[Not[LessEqual[x, 4.5e-288]], $MachinePrecision]], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+96}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-49} \lor \neg \left(x \leq 4.5 \cdot 10^{-288}\right):\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{t}{-0.5}}\\
\end{array}
\end{array}
if x < -1.64999999999999992e96Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 70.6%
*-commutative70.6%
associate-*l/70.6%
associate-*r/70.4%
Simplified70.4%
if -1.64999999999999992e96 < x < -6.6e-49 or 4.5000000000000002e-288 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 41.7%
if -6.6e-49 < x < 4.5000000000000002e-288Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 46.6%
*-commutative46.6%
associate-/r/46.6%
Simplified46.6%
Final simplification48.5%
(FPCore (x y z t) :precision binary64 (if (<= x -5.8e-24) (/ -0.5 (/ (- t) (+ x y))) (* 0.5 (/ (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.8e-24) {
tmp = -0.5 / (-t / (x + y));
} 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) :: tmp
if (x <= (-5.8d-24)) then
tmp = (-0.5d0) / (-t / (x + y))
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 tmp;
if (x <= -5.8e-24) {
tmp = -0.5 / (-t / (x + y));
} else {
tmp = 0.5 * ((y - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.8e-24: tmp = -0.5 / (-t / (x + y)) else: tmp = 0.5 * ((y - z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.8e-24) tmp = Float64(-0.5 / Float64(Float64(-t) / Float64(x + y))); else tmp = Float64(0.5 * Float64(Float64(y - z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.8e-24) tmp = -0.5 / (-t / (x + y)); else tmp = 0.5 * ((y - z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.8e-24], N[(-0.5 / N[((-t) / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-24}:\\
\;\;\;\;\frac{-0.5}{\frac{-t}{x + y}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if x < -5.7999999999999997e-24Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-*l/100.0%
associate-/l*99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 87.8%
associate-*r/87.8%
neg-mul-187.8%
Simplified87.8%
if -5.7999999999999997e-24 < x Initial program 100.0%
Taylor expanded in x around 0 72.4%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (<= y 1.52e-78) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.52e-78) {
tmp = 0.5 * ((x - z) / t);
} 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) :: tmp
if (y <= 1.52d-78) then
tmp = 0.5d0 * ((x - z) / t)
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 tmp;
if (y <= 1.52e-78) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((y - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.52e-78: tmp = 0.5 * ((x - z) / t) else: tmp = 0.5 * ((y - z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.52e-78) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(0.5 * Float64(Float64(y - z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.52e-78) tmp = 0.5 * ((x - z) / t); else tmp = 0.5 * ((y - z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.52e-78], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.52 \cdot 10^{-78}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if y < 1.52e-78Initial program 100.0%
Taylor expanded in y around 0 72.8%
if 1.52e-78 < y Initial program 100.0%
Taylor expanded in x around 0 75.0%
Final simplification73.5%
(FPCore (x y z t) :precision binary64 (if (<= x -9.5e-24) (* (+ x y) (/ 0.5 t)) (* 0.5 (/ (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e-24) {
tmp = (x + y) * (0.5 / t);
} 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) :: tmp
if (x <= (-9.5d-24)) then
tmp = (x + y) * (0.5d0 / t)
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 tmp;
if (x <= -9.5e-24) {
tmp = (x + y) * (0.5 / t);
} else {
tmp = 0.5 * ((y - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.5e-24: tmp = (x + y) * (0.5 / t) else: tmp = 0.5 * ((y - z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.5e-24) tmp = Float64(Float64(x + y) * Float64(0.5 / t)); else tmp = Float64(0.5 * Float64(Float64(y - z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -9.5e-24) tmp = (x + y) * (0.5 / t); else tmp = 0.5 * ((y - z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e-24], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-24}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if x < -9.50000000000000029e-24Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 87.9%
+-commutative87.9%
associate-*r/87.9%
associate-*l/87.7%
*-commutative87.7%
+-commutative87.7%
Simplified87.7%
if -9.50000000000000029e-24 < x Initial program 100.0%
Taylor expanded in x around 0 72.4%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (* (- z (+ x y)) (/ -0.5 t)))
double code(double x, double y, double z, double t) {
return (z - (x + 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 = (z - (x + y)) * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
return (z - (x + y)) * (-0.5 / t);
}
def code(x, y, z, t): return (z - (x + y)) * (-0.5 / t)
function code(x, y, z, t) return Float64(Float64(z - Float64(x + y)) * Float64(-0.5 / t)) end
function tmp = code(x, y, z, t) tmp = (z - (x + y)) * (-0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z - \left(x + y\right)\right) \cdot \frac{-0.5}{t}
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (/ -0.5 (/ t (- z (+ x y)))))
double code(double x, double y, double z, double t) {
return -0.5 / (t / (z - (x + y)));
}
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 / (z - (x + y)))
end function
public static double code(double x, double y, double z, double t) {
return -0.5 / (t / (z - (x + y)));
}
def code(x, y, z, t): return -0.5 / (t / (z - (x + y)))
function code(x, y, z, t) return Float64(-0.5 / Float64(t / Float64(z - Float64(x + y)))) end
function tmp = code(x, y, z, t) tmp = -0.5 / (t / (z - (x + y))); end
code[x_, y_, z_, t_] := N[(-0.5 / N[(t / N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{\frac{t}{z - \left(x + y\right)}}
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-*l/100.0%
associate-/l*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (<= y 1.3e-68) (* 0.5 (/ x t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3e-68) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (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 (y <= 1.3d-68) then
tmp = 0.5d0 * (x / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3e-68) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.3e-68: tmp = 0.5 * (x / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.3e-68) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.3e-68) tmp = 0.5 * (x / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.3e-68], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-68}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 1.2999999999999999e-68Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 41.3%
if 1.2999999999999999e-68 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 59.1%
Final simplification46.9%
(FPCore (x y z t) :precision binary64 (if (<= y 1.3e-68) (* x (/ 0.5 t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3e-68) {
tmp = x * (0.5 / t);
} else {
tmp = 0.5 * (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 (y <= 1.3d-68) then
tmp = x * (0.5d0 / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.3e-68) {
tmp = x * (0.5 / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.3e-68: tmp = x * (0.5 / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.3e-68) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.3e-68) tmp = x * (0.5 / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.3e-68], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 1.2999999999999999e-68Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 41.3%
*-commutative41.3%
associate-*l/41.3%
associate-*r/41.2%
Simplified41.2%
if 1.2999999999999999e-68 < y Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 59.1%
Final simplification46.8%
(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%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 38.1%
Final simplification38.1%
herbie shell --seed 2023224
(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)))