
(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 13 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 (let* ((t_1 (/ (* z -0.5) t))) (if (<= z -5.5e+22) t_1 (if (<= z 8.2e+135) (/ 0.5 (/ t (+ x y))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (z * -0.5) / t;
double tmp;
if (z <= -5.5e+22) {
tmp = t_1;
} else if (z <= 8.2e+135) {
tmp = 0.5 / (t / (x + y));
} else {
tmp = t_1;
}
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 (z <= (-5.5d+22)) then
tmp = t_1
else if (z <= 8.2d+135) then
tmp = 0.5d0 / (t / (x + y))
else
tmp = t_1
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 (z <= -5.5e+22) {
tmp = t_1;
} else if (z <= 8.2e+135) {
tmp = 0.5 / (t / (x + y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * -0.5) / t tmp = 0 if z <= -5.5e+22: tmp = t_1 elif z <= 8.2e+135: tmp = 0.5 / (t / (x + y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * -0.5) / t) tmp = 0.0 if (z <= -5.5e+22) tmp = t_1; elseif (z <= 8.2e+135) tmp = Float64(0.5 / Float64(t / Float64(x + y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * -0.5) / t; tmp = 0.0; if (z <= -5.5e+22) tmp = t_1; elseif (z <= 8.2e+135) tmp = 0.5 / (t / (x + y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[z, -5.5e+22], t$95$1, If[LessEqual[z, 8.2e+135], N[(0.5 / N[(t / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot -0.5}{t}\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+135}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x + y}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.50000000000000021e22 or 8.2e135 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6473.3%
Simplified73.3%
if -5.50000000000000021e22 < z < 8.2e135Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.6%
Applied egg-rr99.6%
Taylor expanded in z around 0
/-lowering-/.f64N/A
+-lowering-+.f6489.0%
Simplified89.0%
(FPCore (x y z t) :precision binary64 (if (<= x -5.8e+31) (/ (* x 0.5) t) (if (<= x -1.6e-239) (/ (* z -0.5) t) (/ (* y 0.5) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.8e+31) {
tmp = (x * 0.5) / t;
} else if (x <= -1.6e-239) {
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 <= (-5.8d+31)) then
tmp = (x * 0.5d0) / t
else if (x <= (-1.6d-239)) 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 <= -5.8e+31) {
tmp = (x * 0.5) / t;
} else if (x <= -1.6e-239) {
tmp = (z * -0.5) / t;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.8e+31: tmp = (x * 0.5) / t elif x <= -1.6e-239: tmp = (z * -0.5) / t else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.8e+31) tmp = Float64(Float64(x * 0.5) / t); elseif (x <= -1.6e-239) tmp = Float64(Float64(z * -0.5) / t); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.8e+31) tmp = (x * 0.5) / t; elseif (x <= -1.6e-239) tmp = (z * -0.5) / t; else tmp = (y * 0.5) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.8e+31], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, -1.6e-239], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+31}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-239}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if x < -5.8000000000000001e31Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6469.7%
Simplified69.7%
if -5.8000000000000001e31 < x < -1.6e-239Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6450.6%
Simplified50.6%
if -1.6e-239 < x Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6437.7%
Simplified37.7%
Final simplification46.7%
(FPCore (x y z t) :precision binary64 (if (<= x -6.4e+35) (/ (* x 0.5) t) (if (<= x -1.44e-241) (* z (/ -0.5 t)) (/ (* y 0.5) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.4e+35) {
tmp = (x * 0.5) / t;
} else if (x <= -1.44e-241) {
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.4d+35)) then
tmp = (x * 0.5d0) / t
else if (x <= (-1.44d-241)) 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.4e+35) {
tmp = (x * 0.5) / t;
} else if (x <= -1.44e-241) {
tmp = z * (-0.5 / t);
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.4e+35: tmp = (x * 0.5) / t elif x <= -1.44e-241: 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.4e+35) tmp = Float64(Float64(x * 0.5) / t); elseif (x <= -1.44e-241) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.4e+35) tmp = (x * 0.5) / t; elseif (x <= -1.44e-241) 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.4e+35], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, -1.44e-241], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{+35}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{elif}\;x \leq -1.44 \cdot 10^{-241}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if x < -6.39999999999999965e35Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6469.7%
Simplified69.7%
if -6.39999999999999965e35 < x < -1.44000000000000006e-241Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6450.6%
Simplified50.6%
associate-/l*N/A
*-commutativeN/A
clear-numN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
clear-numN/A
/-lowering-/.f6450.5%
Applied egg-rr50.5%
if -1.44000000000000006e-241 < x Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6437.7%
Simplified37.7%
Final simplification46.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.3e+34) (/ (* x 0.5) t) (if (<= x -3.8e-240) (* z (/ -0.5 t)) (/ 0.5 (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+34) {
tmp = (x * 0.5) / t;
} else if (x <= -3.8e-240) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 / (t / y);
}
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 <= (-2.3d+34)) then
tmp = (x * 0.5d0) / t
else if (x <= (-3.8d-240)) then
tmp = z * ((-0.5d0) / t)
else
tmp = 0.5d0 / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.3e+34) {
tmp = (x * 0.5) / t;
} else if (x <= -3.8e-240) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.3e+34: tmp = (x * 0.5) / t elif x <= -3.8e-240: tmp = z * (-0.5 / t) else: tmp = 0.5 / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.3e+34) tmp = Float64(Float64(x * 0.5) / t); elseif (x <= -3.8e-240) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(0.5 / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.3e+34) tmp = (x * 0.5) / t; elseif (x <= -3.8e-240) tmp = z * (-0.5 / t); else tmp = 0.5 / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.3e+34], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, -3.8e-240], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+34}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-240}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -2.2999999999999998e34Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6469.7%
Simplified69.7%
if -2.2999999999999998e34 < x < -3.79999999999999988e-240Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6450.6%
Simplified50.6%
associate-/l*N/A
*-commutativeN/A
clear-numN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
clear-numN/A
/-lowering-/.f6450.5%
Applied egg-rr50.5%
if -3.79999999999999988e-240 < x Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.5%
Applied egg-rr99.5%
Taylor expanded in y around inf
/-lowering-/.f6437.6%
Simplified37.6%
Final simplification46.6%
(FPCore (x y z t) :precision binary64 (if (<= x -1.4e+35) (/ 0.5 (/ t x)) (if (<= x -5.8e-239) (* z (/ -0.5 t)) (/ 0.5 (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.4e+35) {
tmp = 0.5 / (t / x);
} else if (x <= -5.8e-239) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 / (t / y);
}
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.4d+35)) then
tmp = 0.5d0 / (t / x)
else if (x <= (-5.8d-239)) then
tmp = z * ((-0.5d0) / t)
else
tmp = 0.5d0 / (t / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.4e+35) {
tmp = 0.5 / (t / x);
} else if (x <= -5.8e-239) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.4e+35: tmp = 0.5 / (t / x) elif x <= -5.8e-239: tmp = z * (-0.5 / t) else: tmp = 0.5 / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.4e+35) tmp = Float64(0.5 / Float64(t / x)); elseif (x <= -5.8e-239) tmp = Float64(z * Float64(-0.5 / t)); else tmp = Float64(0.5 / Float64(t / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.4e+35) tmp = 0.5 / (t / x); elseif (x <= -5.8e-239) tmp = z * (-0.5 / t); else tmp = 0.5 / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.4e+35], N[(0.5 / N[(t / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.8e-239], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+35}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x}}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-239}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y}}\\
\end{array}
\end{array}
if x < -1.39999999999999999e35Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6469.7%
Simplified69.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6469.5%
Applied egg-rr69.5%
if -1.39999999999999999e35 < x < -5.8000000000000004e-239Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6450.6%
Simplified50.6%
associate-/l*N/A
*-commutativeN/A
clear-numN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
clear-numN/A
/-lowering-/.f6450.5%
Applied egg-rr50.5%
if -5.8000000000000004e-239 < x Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.5%
Applied egg-rr99.5%
Taylor expanded in y around inf
/-lowering-/.f6437.6%
Simplified37.6%
Final simplification46.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-230) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-230) {
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 ((x + y) <= (-1d-230)) 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 ((x + y) <= -1e-230) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-230: 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 (Float64(x + y) <= -1e-230) 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 ((x + y) <= -1e-230) 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[N[(x + y), $MachinePrecision], -1e-230], 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}\;x + y \leq -1 \cdot 10^{-230}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000005e-230Initial program 100.0%
Taylor expanded in y around 0
--lowering--.f6464.2%
Simplified64.2%
if -1.00000000000000005e-230 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
--lowering--.f6468.9%
Simplified68.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 5e+39) (/ (- x z) (* t 2.0)) (/ (+ x y) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e+39) {
tmp = (x - z) / (t * 2.0);
} 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 ((x + y) <= 5d+39) then
tmp = (x - z) / (t * 2.0d0)
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 ((x + y) <= 5e+39) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (x + y) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 5e+39: tmp = (x - z) / (t * 2.0) else: tmp = (x + y) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 5e+39) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); 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 ((x + y) <= 5e+39) tmp = (x - z) / (t * 2.0); else tmp = (x + y) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 5e+39], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < 5.00000000000000015e39Initial program 100.0%
Taylor expanded in y around 0
--lowering--.f6469.0%
Simplified69.0%
if 5.00000000000000015e39 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f6480.6%
Simplified80.6%
Final simplification73.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 5e+39) (/ 0.5 (/ t (- x z))) (/ (+ x y) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e+39) {
tmp = 0.5 / (t / (x - z));
} 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 ((x + y) <= 5d+39) then
tmp = 0.5d0 / (t / (x - z))
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 ((x + y) <= 5e+39) {
tmp = 0.5 / (t / (x - z));
} else {
tmp = (x + y) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 5e+39: tmp = 0.5 / (t / (x - z)) else: tmp = (x + y) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 5e+39) tmp = Float64(0.5 / Float64(t / Float64(x - z))); 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 ((x + y) <= 5e+39) tmp = 0.5 / (t / (x - z)); else tmp = (x + y) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 5e+39], N[(0.5 / N[(t / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x - z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < 5.00000000000000015e39Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.6%
Applied egg-rr99.6%
Taylor expanded in y around 0
/-lowering-/.f64N/A
--lowering--.f6468.8%
Simplified68.8%
if 5.00000000000000015e39 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f6480.6%
Simplified80.6%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 5e+39) (/ 0.5 (/ t (- x z))) (/ 0.5 (/ t (+ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e+39) {
tmp = 0.5 / (t / (x - z));
} else {
tmp = 0.5 / (t / (x + y));
}
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 + y) <= 5d+39) then
tmp = 0.5d0 / (t / (x - z))
else
tmp = 0.5d0 / (t / (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 5e+39) {
tmp = 0.5 / (t / (x - z));
} else {
tmp = 0.5 / (t / (x + y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 5e+39: tmp = 0.5 / (t / (x - z)) else: tmp = 0.5 / (t / (x + y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 5e+39) tmp = Float64(0.5 / Float64(t / Float64(x - z))); else tmp = Float64(0.5 / Float64(t / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= 5e+39) tmp = 0.5 / (t / (x - z)); else tmp = 0.5 / (t / (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 5e+39], N[(0.5 / N[(t / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 5 \cdot 10^{+39}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x - z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x + y}}\\
\end{array}
\end{array}
if (+.f64 x y) < 5.00000000000000015e39Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.6%
Applied egg-rr99.6%
Taylor expanded in y around 0
/-lowering-/.f64N/A
--lowering--.f6468.8%
Simplified68.8%
if 5.00000000000000015e39 < (+.f64 x y) Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.5%
Applied egg-rr99.5%
Taylor expanded in z around 0
/-lowering-/.f64N/A
+-lowering-+.f6480.3%
Simplified80.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.2e+34) (/ 0.5 (/ t x)) (* z (/ -0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.2e+34) {
tmp = 0.5 / (t / x);
} else {
tmp = 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.2d+34)) then
tmp = 0.5d0 / (t / x)
else
tmp = 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.2e+34) {
tmp = 0.5 / (t / x);
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.2e+34: tmp = 0.5 / (t / x) else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.2e+34) tmp = Float64(0.5 / Float64(t / x)); else tmp = Float64(z * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.2e+34) tmp = 0.5 / (t / x); else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.2e+34], N[(0.5 / N[(t / x), $MachinePrecision]), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+34}:\\
\;\;\;\;\frac{0.5}{\frac{t}{x}}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if x < -1.19999999999999993e34Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6469.7%
Simplified69.7%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6469.5%
Applied egg-rr69.5%
if -1.19999999999999993e34 < x Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6440.6%
Simplified40.6%
associate-/l*N/A
*-commutativeN/A
clear-numN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
clear-numN/A
/-lowering-/.f6440.5%
Applied egg-rr40.5%
Final simplification45.7%
(FPCore (x y z t) :precision binary64 (/ 0.5 (/ t (+ x (- y z)))))
double code(double x, double y, double z, double t) {
return 0.5 / (t / (x + (y - 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 / (x + (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return 0.5 / (t / (x + (y - z)));
}
def code(x, y, z, t): return 0.5 / (t / (x + (y - z)))
function code(x, y, z, t) return Float64(0.5 / Float64(t / Float64(x + Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = 0.5 / (t / (x + (y - z))); end
code[x_, y_, z_, t_] := N[(0.5 / N[(t / N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{\frac{t}{x + \left(y - z\right)}}
\end{array}
Initial program 100.0%
associate-/r*N/A
clear-numN/A
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
metadata-evalN/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f6499.6%
Applied egg-rr99.6%
(FPCore (x y z t) :precision binary64 (* z (/ -0.5 t)))
double code(double x, double y, double z, double t) {
return z * (-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 * ((-0.5d0) / t)
end function
public static double code(double x, double y, double z, double t) {
return z * (-0.5 / t);
}
def code(x, y, z, t): return z * (-0.5 / t)
function code(x, y, z, t) return Float64(z * Float64(-0.5 / t)) end
function tmp = code(x, y, z, t) tmp = z * (-0.5 / t); end
code[x_, y_, z_, t_] := N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \frac{-0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6437.3%
Simplified37.3%
associate-/l*N/A
*-commutativeN/A
clear-numN/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
div-invN/A
clear-numN/A
/-lowering-/.f6437.2%
Applied egg-rr37.2%
Final simplification37.2%
herbie shell --seed 2024191
(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)))