
(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 (* (/ 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(Float64(0.5 / 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[(N[(0.5 / t), $MachinePrecision] * N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{t} \cdot \left(x + \left(y - z\right)\right)
\end{array}
Initial program 99.6%
associate--l+99.6%
Simplified99.6%
clear-num99.0%
associate-/r/99.4%
*-commutative99.4%
associate-/r*99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-53) (* 0.5 (/ x t)) (if (<= (+ x y) 5e+40) (/ -0.5 (/ t z)) (/ 0.5 (/ t y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else if ((x + y) <= 5e+40) {
tmp = -0.5 / (t / z);
} 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 + y) <= (-1d-53)) then
tmp = 0.5d0 * (x / t)
else if ((x + y) <= 5d+40) then
tmp = (-0.5d0) / (t / z)
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 + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else if ((x + y) <= 5e+40) {
tmp = -0.5 / (t / z);
} else {
tmp = 0.5 / (t / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-53: tmp = 0.5 * (x / t) elif (x + y) <= 5e+40: tmp = -0.5 / (t / z) else: tmp = 0.5 / (t / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-53) tmp = Float64(0.5 * Float64(x / t)); elseif (Float64(x + y) <= 5e+40) tmp = Float64(-0.5 / Float64(t / z)); 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 + y) <= -1e-53) tmp = 0.5 * (x / t); elseif ((x + y) <= 5e+40) tmp = -0.5 / (t / z); else tmp = 0.5 / (t / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-53], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 5e+40], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-53}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x + y \leq 5 \cdot 10^{+40}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y}}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000003e-53Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in x around inf 36.4%
if -1.00000000000000003e-53 < (+.f64 x y) < 5.00000000000000003e40Initial program 99.9%
associate--l+99.9%
Simplified99.9%
clear-num98.3%
associate-/r/99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
Applied egg-rr99.9%
associate-*l/99.9%
associate-/l*98.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 75.7%
associate-*r/77.1%
associate-/l*76.8%
Simplified76.8%
if 5.00000000000000003e40 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
clear-num99.8%
associate-/r/99.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*l/100.0%
associate-/l*99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 43.8%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-53) (* 0.5 (/ x t)) (if (<= (+ x y) 5e+40) (/ -0.5 (/ t z)) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else if ((x + y) <= 5e+40) {
tmp = -0.5 / (t / z);
} 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 ((x + y) <= (-1d-53)) then
tmp = 0.5d0 * (x / t)
else if ((x + y) <= 5d+40) then
tmp = (-0.5d0) / (t / z)
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 ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else if ((x + y) <= 5e+40) {
tmp = -0.5 / (t / z);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-53: tmp = 0.5 * (x / t) elif (x + y) <= 5e+40: tmp = -0.5 / (t / z) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-53) tmp = Float64(0.5 * Float64(x / t)); elseif (Float64(x + y) <= 5e+40) tmp = Float64(-0.5 / Float64(t / z)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e-53) tmp = 0.5 * (x / t); elseif ((x + y) <= 5e+40) tmp = -0.5 / (t / z); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-53], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 5e+40], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-53}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x + y \leq 5 \cdot 10^{+40}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000003e-53Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in x around inf 36.4%
if -1.00000000000000003e-53 < (+.f64 x y) < 5.00000000000000003e40Initial program 99.9%
associate--l+99.9%
Simplified99.9%
clear-num98.3%
associate-/r/99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
Applied egg-rr99.9%
associate-*l/99.9%
associate-/l*98.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 75.7%
associate-*r/77.1%
associate-/l*76.8%
Simplified76.8%
if 5.00000000000000003e40 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 43.9%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-53) (* 0.5 (/ x t)) (if (<= (+ x y) 5e+40) (/ z (/ t -0.5)) (/ y (* t 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else if ((x + y) <= 5e+40) {
tmp = z / (t / -0.5);
} 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 ((x + y) <= (-1d-53)) then
tmp = 0.5d0 * (x / t)
else if ((x + y) <= 5d+40) then
tmp = z / (t / (-0.5d0))
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 ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else if ((x + y) <= 5e+40) {
tmp = z / (t / -0.5);
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-53: tmp = 0.5 * (x / t) elif (x + y) <= 5e+40: tmp = z / (t / -0.5) else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-53) tmp = Float64(0.5 * Float64(x / t)); elseif (Float64(x + y) <= 5e+40) tmp = Float64(z / Float64(t / -0.5)); else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e-53) tmp = 0.5 * (x / t); elseif ((x + y) <= 5e+40) tmp = z / (t / -0.5); else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-53], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 5e+40], N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision], N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-53}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x + y \leq 5 \cdot 10^{+40}:\\
\;\;\;\;\frac{z}{\frac{t}{-0.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000003e-53Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in x around inf 36.4%
if -1.00000000000000003e-53 < (+.f64 x y) < 5.00000000000000003e40Initial program 99.9%
associate--l+99.9%
Simplified99.9%
clear-num98.3%
associate-/r/99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 75.7%
associate-*r/77.1%
*-commutative77.1%
associate-/l*77.1%
Simplified77.1%
if 5.00000000000000003e40 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 43.9%
Final simplification48.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.1e+32) (not (<= z 9.5e-23))) (* (/ 0.5 t) (- y z)) (* (/ 0.5 t) (+ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e+32) || !(z <= 9.5e-23)) {
tmp = (0.5 / t) * (y - 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 ((z <= (-3.1d+32)) .or. (.not. (z <= 9.5d-23))) then
tmp = (0.5d0 / t) * (y - 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 ((z <= -3.1e+32) || !(z <= 9.5e-23)) {
tmp = (0.5 / t) * (y - z);
} else {
tmp = (0.5 / t) * (x + y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.1e+32) or not (z <= 9.5e-23): tmp = (0.5 / t) * (y - z) else: tmp = (0.5 / t) * (x + y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.1e+32) || !(z <= 9.5e-23)) tmp = Float64(Float64(0.5 / t) * Float64(y - z)); else tmp = Float64(Float64(0.5 / t) * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.1e+32) || ~((z <= 9.5e-23))) tmp = (0.5 / t) * (y - z); else tmp = (0.5 / t) * (x + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.1e+32], N[Not[LessEqual[z, 9.5e-23]], $MachinePrecision]], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+32} \lor \neg \left(z \leq 9.5 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\
\end{array}
\end{array}
if z < -3.09999999999999993e32 or 9.50000000000000058e-23 < z Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 87.2%
associate-*r/87.9%
associate-*l/87.8%
*-commutative87.8%
Simplified87.8%
if -3.09999999999999993e32 < z < 9.50000000000000058e-23Initial program 99.3%
associate--l+99.3%
Simplified99.3%
clear-num98.5%
associate-/r/99.1%
*-commutative99.1%
associate-/r*99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 94.7%
+-commutative94.1%
Simplified94.7%
Final simplification91.5%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -1e-53) (* 0.5 (/ x t)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} 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) :: tmp
if ((x + y) <= (-1d-53)) then
tmp = 0.5d0 * (x / t)
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 tmp;
if ((x + y) <= -1e-53) {
tmp = 0.5 * (x / t);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -1e-53: tmp = 0.5 * (x / t) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -1e-53) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -1e-53) tmp = 0.5 * (x / t); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-53], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-53}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -1.00000000000000003e-53Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in x around inf 36.4%
if -1.00000000000000003e-53 < (+.f64 x y) Initial program 99.9%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 73.8%
associate-*r/74.3%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-130) (/ (- x z) (* t 2.0)) (* (/ 0.5 t) (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-130) {
tmp = (x - z) / (t * 2.0);
} 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) :: tmp
if ((x + y) <= (-5d-130)) then
tmp = (x - z) / (t * 2.0d0)
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 tmp;
if ((x + y) <= -5e-130) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (0.5 / t) * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-130: tmp = (x - z) / (t * 2.0) else: tmp = (0.5 / t) * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-130) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(Float64(0.5 / t) * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + y) <= -5e-130) tmp = (x - z) / (t * 2.0); else tmp = (0.5 / t) * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-130], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-130}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999996e-130Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in y around 0 60.7%
if -4.9999999999999996e-130 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 73.8%
associate-*r/74.3%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-130) (/ (- 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) <= -5e-130) {
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) <= (-5d-130)) 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) <= -5e-130) {
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) <= -5e-130: 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) <= -5e-130) 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) <= -5e-130) 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], -5e-130], 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 -5 \cdot 10^{-130}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999996e-130Initial program 99.1%
associate--l+99.1%
Simplified99.1%
Taylor expanded in y around 0 60.7%
if -4.9999999999999996e-130 < (+.f64 x y) Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 74.3%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e+33) (not (<= z 2.45e-24))) (* -0.5 (/ z t)) (* 0.5 (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+33) || !(z <= 2.45e-24)) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (x / 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.2d+33)) .or. (.not. (z <= 2.45d-24))) then
tmp = (-0.5d0) * (z / t)
else
tmp = 0.5d0 * (x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+33) || !(z <= 2.45e-24)) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e+33) or not (z <= 2.45e-24): tmp = -0.5 * (z / t) else: tmp = 0.5 * (x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e+33) || !(z <= 2.45e-24)) tmp = Float64(-0.5 * Float64(z / t)); else tmp = Float64(0.5 * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.2e+33) || ~((z <= 2.45e-24))) tmp = -0.5 * (z / t); else tmp = 0.5 * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e+33], N[Not[LessEqual[z, 2.45e-24]], $MachinePrecision]], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+33} \lor \neg \left(z \leq 2.45 \cdot 10^{-24}\right):\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -1.2e33 or 2.45e-24 < z Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 70.6%
*-commutative70.6%
Simplified70.6%
if -1.2e33 < z < 2.45e-24Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around inf 49.9%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 (if (<= z -5.5e+32) (/ -0.5 (/ t z)) (if (<= z 3.7e-21) (* 0.5 (/ x t)) (* -0.5 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+32) {
tmp = -0.5 / (t / z);
} else if (z <= 3.7e-21) {
tmp = 0.5 * (x / t);
} else {
tmp = -0.5 * (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 (z <= (-5.5d+32)) then
tmp = (-0.5d0) / (t / z)
else if (z <= 3.7d-21) then
tmp = 0.5d0 * (x / t)
else
tmp = (-0.5d0) * (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+32) {
tmp = -0.5 / (t / z);
} else if (z <= 3.7e-21) {
tmp = 0.5 * (x / t);
} else {
tmp = -0.5 * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e+32: tmp = -0.5 / (t / z) elif z <= 3.7e-21: tmp = 0.5 * (x / t) else: tmp = -0.5 * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e+32) tmp = Float64(-0.5 / Float64(t / z)); elseif (z <= 3.7e-21) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(-0.5 * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.5e+32) tmp = -0.5 / (t / z); elseif (z <= 3.7e-21) tmp = 0.5 * (x / t); else tmp = -0.5 * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+32], N[(-0.5 / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e-21], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{-0.5}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-21}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -5.49999999999999984e32Initial program 100.0%
associate--l+100.0%
Simplified100.0%
clear-num99.6%
associate-/r/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*l/100.0%
associate-/l*99.6%
Applied egg-rr99.6%
Taylor expanded in z around inf 78.5%
associate-*r/80.1%
associate-/l*79.7%
Simplified79.7%
if -5.49999999999999984e32 < z < 3.7000000000000002e-21Initial program 99.3%
associate--l+99.3%
Simplified99.3%
Taylor expanded in x around inf 49.9%
if 3.7000000000000002e-21 < z Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 65.1%
*-commutative65.1%
Simplified65.1%
Final simplification59.7%
(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 99.6%
associate--l+99.6%
Simplified99.6%
Taylor expanded in x around inf 36.0%
Final simplification36.0%
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
return 0.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 = 0.0d0
end function
public static double code(double x, double y, double z, double t) {
return 0.0;
}
def code(x, y, z, t): return 0.0
function code(x, y, z, t) return 0.0 end
function tmp = code(x, y, z, t) tmp = 0.0; end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 99.6%
associate--l+99.6%
Simplified99.6%
Taylor expanded in z around 0 67.8%
+-commutative67.8%
Simplified67.8%
+-commutative67.8%
*-commutative67.8%
count-267.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
associate-/r/0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
mul0-rgt4.5%
Simplified4.5%
Final simplification4.5%
herbie shell --seed 2023297
(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)))