
(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 14 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%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-invN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.7
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.7
Applied egg-rr99.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ (- (+ x y) z) (* t 2.0)) -4e-274) (/ -0.5 t) (- (/ x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((((x + y) - z) / (t * 2.0)) <= -4e-274) {
tmp = -0.5 / t;
} else {
tmp = -(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 ((((x + y) - z) / (t * 2.0d0)) <= (-4d-274)) then
tmp = (-0.5d0) / t
else
tmp = -(x / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((((x + y) - z) / (t * 2.0)) <= -4e-274) {
tmp = -0.5 / t;
} else {
tmp = -(x / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (((x + y) - z) / (t * 2.0)) <= -4e-274: tmp = -0.5 / t else: tmp = -(x / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) <= -4e-274) tmp = Float64(-0.5 / t); else tmp = Float64(-Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((((x + y) - z) / (t * 2.0)) <= -4e-274) tmp = -0.5 / t; else tmp = -(x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], -4e-274], N[(-0.5 / t), $MachinePrecision], (-N[(x / t), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(x + y\right) - z}{t \cdot 2} \leq -4 \cdot 10^{-274}:\\
\;\;\;\;\frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{t}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 x y) z) (*.f64 t #s(literal 2 binary64))) < -3.99999999999999986e-274Initial program 99.9%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6430.8
Simplified30.8%
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6430.7
Applied egg-rr30.7%
Taylor expanded in t around 0
lower-/.f643.7
Simplified3.7%
if -3.99999999999999986e-274 < (/.f64 (-.f64 (+.f64 x y) z) (*.f64 t #s(literal 2 binary64))) Initial program 99.3%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6441.4
Simplified41.4%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f649.2
Simplified9.2%
Final simplification6.6%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-12) (/ (* 0.5 x) t) (if (<= (+ x y) 1e-13) (/ (* z -0.5) t) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-12) {
tmp = (0.5 * x) / t;
} else if ((x + y) <= 1e-13) {
tmp = (z * -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 ((x + y) <= (-5d-12)) then
tmp = (0.5d0 * x) / t
else if ((x + y) <= 1d-13) then
tmp = (z * (-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 ((x + y) <= -5e-12) {
tmp = (0.5 * x) / t;
} else if ((x + y) <= 1e-13) {
tmp = (z * -0.5) / t;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-12: tmp = (0.5 * x) / t elif (x + y) <= 1e-13: tmp = (z * -0.5) / t else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-12) tmp = Float64(Float64(0.5 * x) / t); elseif (Float64(x + y) <= 1e-13) tmp = Float64(Float64(z * -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 ((x + y) <= -5e-12) tmp = (0.5 * x) / t; elseif ((x + y) <= 1e-13) tmp = (z * -0.5) / t; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-12], N[(N[(0.5 * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-13], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-12}:\\
\;\;\;\;\frac{0.5 \cdot x}{t}\\
\mathbf{elif}\;x + y \leq 10^{-13}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999997e-12Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Simplified46.2%
if -4.9999999999999997e-12 < (+.f64 x y) < 1e-13Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6474.6
Simplified74.6%
if 1e-13 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f6442.7
Simplified42.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-12) (/ (* 0.5 x) t) (if (<= (+ x y) 1e-13) (* z (/ -0.5 t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-12) {
tmp = (0.5 * x) / t;
} else if ((x + y) <= 1e-13) {
tmp = z * (-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 ((x + y) <= (-5d-12)) then
tmp = (0.5d0 * x) / t
else if ((x + y) <= 1d-13) then
tmp = z * ((-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 ((x + y) <= -5e-12) {
tmp = (0.5 * x) / t;
} else if ((x + y) <= 1e-13) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-12: tmp = (0.5 * x) / t elif (x + y) <= 1e-13: tmp = z * (-0.5 / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-12) tmp = Float64(Float64(0.5 * x) / t); elseif (Float64(x + y) <= 1e-13) tmp = Float64(z * 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 ((x + y) <= -5e-12) tmp = (0.5 * x) / t; elseif ((x + y) <= 1e-13) tmp = z * (-0.5 / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-12], N[(N[(0.5 * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-13], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-12}:\\
\;\;\;\;\frac{0.5 \cdot x}{t}\\
\mathbf{elif}\;x + y \leq 10^{-13}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999997e-12Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Simplified46.2%
if -4.9999999999999997e-12 < (+.f64 x y) < 1e-13Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6474.6
Simplified74.6%
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6474.4
Applied egg-rr74.4%
if 1e-13 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f6442.7
Simplified42.7%
Final simplification50.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -5e-12) (* (/ 0.5 t) x) (if (<= (+ x y) 1e-13) (* z (/ -0.5 t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -5e-12) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 1e-13) {
tmp = z * (-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 ((x + y) <= (-5d-12)) then
tmp = (0.5d0 / t) * x
else if ((x + y) <= 1d-13) then
tmp = z * ((-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 ((x + y) <= -5e-12) {
tmp = (0.5 / t) * x;
} else if ((x + y) <= 1e-13) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -5e-12: tmp = (0.5 / t) * x elif (x + y) <= 1e-13: tmp = z * (-0.5 / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -5e-12) tmp = Float64(Float64(0.5 / t) * x); elseif (Float64(x + y) <= 1e-13) tmp = Float64(z * 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 ((x + y) <= -5e-12) tmp = (0.5 / t) * x; elseif ((x + y) <= 1e-13) tmp = z * (-0.5 / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -5e-12], N[(N[(0.5 / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 1e-13], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -5 \cdot 10^{-12}:\\
\;\;\;\;\frac{0.5}{t} \cdot x\\
\mathbf{elif}\;x + y \leq 10^{-13}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < -4.9999999999999997e-12Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.2
Simplified46.2%
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6446.1
Applied egg-rr46.1%
if -4.9999999999999997e-12 < (+.f64 x y) < 1e-13Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6474.6
Simplified74.6%
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6474.4
Applied egg-rr74.4%
if 1e-13 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f6442.7
Simplified42.7%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* z -0.5) t))) (if (<= z -4.9e+175) t_1 (if (<= z 1.85e+124) (* (/ 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 <= -4.9e+175) {
tmp = t_1;
} else if (z <= 1.85e+124) {
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 <= (-4.9d+175)) then
tmp = t_1
else if (z <= 1.85d+124) 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 <= -4.9e+175) {
tmp = t_1;
} else if (z <= 1.85e+124) {
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 <= -4.9e+175: tmp = t_1 elif z <= 1.85e+124: 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 <= -4.9e+175) tmp = t_1; elseif (z <= 1.85e+124) tmp = Float64(Float64(0.5 / 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 <= -4.9e+175) tmp = t_1; elseif (z <= 1.85e+124) 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, -4.9e+175], t$95$1, If[LessEqual[z, 1.85e+124], N[(N[(0.5 / t), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot -0.5}{t}\\
\mathbf{if}\;z \leq -4.9 \cdot 10^{+175}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+124}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.90000000000000001e175 or 1.85000000000000004e124 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6478.1
Simplified78.1%
if -4.90000000000000001e175 < z < 1.85000000000000004e124Initial program 99.5%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-invN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.6
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.6
Applied egg-rr99.6%
Taylor expanded in z around 0
lower-+.f6485.1
Simplified85.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ z (- t)))) (if (<= z -1.2e+176) t_1 (if (<= z 4.4e+164) (* 0.5 (/ y t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z / -t;
double tmp;
if (z <= -1.2e+176) {
tmp = t_1;
} else if (z <= 4.4e+164) {
tmp = 0.5 * (y / t);
} 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 / -t
if (z <= (-1.2d+176)) then
tmp = t_1
else if (z <= 4.4d+164) then
tmp = 0.5d0 * (y / t)
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 / -t;
double tmp;
if (z <= -1.2e+176) {
tmp = t_1;
} else if (z <= 4.4e+164) {
tmp = 0.5 * (y / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z / -t tmp = 0 if z <= -1.2e+176: tmp = t_1 elif z <= 4.4e+164: tmp = 0.5 * (y / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z / Float64(-t)) tmp = 0.0 if (z <= -1.2e+176) tmp = t_1; elseif (z <= 4.4e+164) tmp = Float64(0.5 * Float64(y / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z / -t; tmp = 0.0; if (z <= -1.2e+176) tmp = t_1; elseif (z <= 4.4e+164) tmp = 0.5 * (y / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z / (-t)), $MachinePrecision]}, If[LessEqual[z, -1.2e+176], t$95$1, If[LessEqual[z, 4.4e+164], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{-t}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+164}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2000000000000001e176 or 4.40000000000000011e164 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6477.4
Simplified77.4%
Taylor expanded in z around -inf
mul-1-negN/A
lower-neg.f6453.5
Simplified53.5%
if -1.2000000000000001e176 < z < 4.40000000000000011e164Initial program 99.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f6443.9
Simplified43.9%
Final simplification45.9%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) -2e-154) (* (/ 0.5 t) (- x z)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= -2e-154) {
tmp = (0.5 / t) * (x - z);
} 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) <= (-2d-154)) then
tmp = (0.5d0 / t) * (x - z)
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) <= -2e-154) {
tmp = (0.5 / t) * (x - z);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= -2e-154: tmp = (0.5 / t) * (x - z) else: tmp = (y - z) / (t * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= -2e-154) tmp = Float64(Float64(0.5 / t) * Float64(x - z)); 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) <= -2e-154) tmp = (0.5 / t) * (x - z); else tmp = (y - z) / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], -2e-154], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -2 \cdot 10^{-154}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < -1.9999999999999999e-154Initial program 99.2%
Taylor expanded in y around 0
lower--.f6467.1
Simplified67.1%
lift--.f64N/A
lift-*.f64N/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied egg-rr66.9%
if -1.9999999999999999e-154 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0
lower--.f6468.1
Simplified68.1%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 1e-13) (* (/ 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) <= 1e-13) {
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) <= 1d-13) 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) <= 1e-13) {
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) <= 1e-13: 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) <= 1e-13) tmp = Float64(Float64(0.5 / 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) <= 1e-13) 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], 1e-13], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 10^{-13}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\end{array}
\end{array}
if (+.f64 x y) < 1e-13Initial program 99.4%
Taylor expanded in y around 0
lower--.f6470.5
Simplified70.5%
lift--.f64N/A
lift-*.f64N/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6470.3
Applied egg-rr70.3%
if 1e-13 < (+.f64 x y) Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f6484.5
Simplified84.5%
Final simplification75.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 1e-13) (* (/ 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) <= 1e-13) {
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) <= 1d-13) 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) <= 1e-13) {
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) <= 1e-13: 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) <= 1e-13) tmp = Float64(Float64(0.5 / t) * Float64(x - 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 ((x + y) <= 1e-13) 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], 1e-13], N[(N[(0.5 / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 / t), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 10^{-13}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\
\end{array}
\end{array}
if (+.f64 x y) < 1e-13Initial program 99.4%
Taylor expanded in y around 0
lower--.f6470.5
Simplified70.5%
lift--.f64N/A
lift-*.f64N/A
div-invN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6470.3
Applied egg-rr70.3%
if 1e-13 < (+.f64 x y) Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
div-invN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.7
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.7
Applied egg-rr99.7%
Taylor expanded in z around 0
lower-+.f6484.2
Simplified84.2%
(FPCore (x y z t) :precision binary64 (if (<= (+ x y) 1e-13) (* z (/ -0.5 t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + y) <= 1e-13) {
tmp = z * (-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 ((x + y) <= 1d-13) then
tmp = z * ((-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 ((x + y) <= 1e-13) {
tmp = z * (-0.5 / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + y) <= 1e-13: tmp = z * (-0.5 / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + y) <= 1e-13) tmp = Float64(z * 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 ((x + y) <= 1e-13) tmp = z * (-0.5 / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + y), $MachinePrecision], 1e-13], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq 10^{-13}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (+.f64 x y) < 1e-13Initial program 99.4%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6438.5
Simplified38.5%
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6438.4
Applied egg-rr38.4%
if 1e-13 < (+.f64 x y) Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f6442.7
Simplified42.7%
Final simplification40.0%
(FPCore (x y z t) :precision binary64 (if (<= (- (+ x y) z) -2.25e-154) (/ -0.5 t) (/ 0.5 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + y) - z) <= -2.25e-154) {
tmp = -0.5 / t;
} else {
tmp = 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 + y) - z) <= (-2.25d-154)) then
tmp = (-0.5d0) / t
else
tmp = 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 + y) - z) <= -2.25e-154) {
tmp = -0.5 / t;
} else {
tmp = 0.5 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + y) - z) <= -2.25e-154: tmp = -0.5 / t else: tmp = 0.5 / t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x + y) - z) <= -2.25e-154) tmp = Float64(-0.5 / t); else tmp = Float64(0.5 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x + y) - z) <= -2.25e-154) tmp = -0.5 / t; else tmp = 0.5 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], -2.25e-154], N[(-0.5 / t), $MachinePrecision], N[(0.5 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x + y\right) - z \leq -2.25 \cdot 10^{-154}:\\
\;\;\;\;\frac{-0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) z) < -2.2499999999999999e-154Initial program 99.2%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6431.6
Simplified31.6%
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6431.5
Applied egg-rr31.5%
Taylor expanded in t around 0
lower-/.f646.0
Simplified6.0%
if -2.2499999999999999e-154 < (-.f64 (+.f64 x y) z) Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6441.6
Simplified41.6%
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6441.4
Applied egg-rr41.4%
Taylor expanded in t around 0
lower-/.f645.5
Simplified5.5%
(FPCore (x y z t) :precision binary64 (/ z (- t)))
double code(double x, double y, double z, double t) {
return z / -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 / -t
end function
public static double code(double x, double y, double z, double t) {
return z / -t;
}
def code(x, y, z, t): return z / -t
function code(x, y, z, t) return Float64(z / Float64(-t)) end
function tmp = code(x, y, z, t) tmp = z / -t; end
code[x_, y_, z_, t_] := N[(z / (-t)), $MachinePrecision]
\begin{array}{l}
\\
\frac{z}{-t}
\end{array}
Initial program 99.6%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6432.5
Simplified32.5%
Taylor expanded in z around -inf
mul-1-negN/A
lower-neg.f6418.7
Simplified18.7%
Final simplification18.7%
(FPCore (x y z t) :precision binary64 (/ -0.5 t))
double code(double x, double y, double z, double t) {
return -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 = (-0.5d0) / t
end function
public static double code(double x, double y, double z, double t) {
return -0.5 / t;
}
def code(x, y, z, t): return -0.5 / t
function code(x, y, z, t) return Float64(-0.5 / t) end
function tmp = code(x, y, z, t) tmp = -0.5 / t; end
code[x_, y_, z_, t_] := N[(-0.5 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{t}
\end{array}
Initial program 99.6%
Taylor expanded in z around inf
associate-*r/N/A
metadata-evalN/A
associate-*r*N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6432.5
Simplified32.5%
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6432.4
Applied egg-rr32.4%
Taylor expanded in t around 0
lower-/.f643.8
Simplified3.8%
herbie shell --seed 2024214
(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)))