
(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 9 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) (- 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(Float64(-0.5 / 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[(N[(-0.5 / t), $MachinePrecision] * N[(z - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.5}{t} \cdot \left(z - \left(x + y\right)\right)
\end{array}
Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
associate-*l/99.3%
*-commutative99.3%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.4e+171) (not (<= z 2.15e+120))) (* -0.5 (/ z t)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+171) || !(z <= 2.15e+120)) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * ((x + 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 ((z <= (-3.4d+171)) .or. (.not. (z <= 2.15d+120))) then
tmp = (-0.5d0) * (z / t)
else
tmp = 0.5d0 * ((x + y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+171) || !(z <= 2.15e+120)) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.4e+171) or not (z <= 2.15e+120): tmp = -0.5 * (z / t) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.4e+171) || !(z <= 2.15e+120)) tmp = Float64(-0.5 * Float64(z / t)); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.4e+171) || ~((z <= 2.15e+120))) tmp = -0.5 * (z / t); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.4e+171], N[Not[LessEqual[z, 2.15e+120]], $MachinePrecision]], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+171} \lor \neg \left(z \leq 2.15 \cdot 10^{+120}\right):\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -3.4000000000000001e171 or 2.1500000000000001e120 < z Initial program 98.9%
sub-neg98.9%
+-commutative98.9%
neg-sub098.9%
associate-+l-98.9%
sub0-neg98.9%
neg-mul-198.9%
associate-*l/98.6%
*-commutative98.6%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 79.2%
if -3.4000000000000001e171 < z < 2.1500000000000001e120Initial 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.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 85.3%
Final simplification83.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.4e-164) (* 0.5 (/ x t)) (if (<= y 1.9e+52) (* -0.5 (/ z t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.4e-164) {
tmp = 0.5 * (x / t);
} else if (y <= 1.9e+52) {
tmp = -0.5 * (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.4d-164)) then
tmp = 0.5d0 * (x / t)
else if (y <= 1.9d+52) then
tmp = (-0.5d0) * (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.4e-164) {
tmp = 0.5 * (x / t);
} else if (y <= 1.9e+52) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.4e-164: tmp = 0.5 * (x / t) elif y <= 1.9e+52: tmp = -0.5 * (z / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.4e-164) tmp = Float64(0.5 * Float64(x / t)); elseif (y <= 1.9e+52) tmp = Float64(-0.5 * Float64(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.4e-164) tmp = 0.5 * (x / t); elseif (y <= 1.9e+52) tmp = -0.5 * (z / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.4e-164], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+52], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-164}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+52}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.4000000000000001e-164Initial program 99.0%
sub-neg99.0%
+-commutative99.0%
neg-sub099.0%
associate-+l-99.0%
sub0-neg99.0%
neg-mul-199.0%
associate-*l/98.7%
*-commutative98.7%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 37.3%
if -1.4000000000000001e-164 < y < 1.9e52Initial 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.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 58.8%
if 1.9e52 < 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.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 56.6%
Final simplification49.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2.1e-151) (* x (/ 0.5 t)) (if (<= y 1.9e+52) (* -0.5 (/ z t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.1e-151) {
tmp = x * (0.5 / t);
} else if (y <= 1.9e+52) {
tmp = -0.5 * (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 <= (-2.1d-151)) then
tmp = x * (0.5d0 / t)
else if (y <= 1.9d+52) then
tmp = (-0.5d0) * (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 <= -2.1e-151) {
tmp = x * (0.5 / t);
} else if (y <= 1.9e+52) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.1e-151: tmp = x * (0.5 / t) elif y <= 1.9e+52: tmp = -0.5 * (z / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.1e-151) tmp = Float64(x * Float64(0.5 / t)); elseif (y <= 1.9e+52) tmp = Float64(-0.5 * Float64(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 <= -2.1e-151) tmp = x * (0.5 / t); elseif (y <= 1.9e+52) tmp = -0.5 * (z / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.1e-151], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+52], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-151}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+52}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -2.0999999999999999e-151Initial program 99.0%
sub-neg99.0%
+-commutative99.0%
neg-sub099.0%
associate-+l-99.0%
sub0-neg99.0%
neg-mul-199.0%
associate-*l/98.7%
*-commutative98.7%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 38.0%
*-commutative38.0%
associate-*l/38.8%
associate-*r/38.6%
Simplified38.6%
if -2.0999999999999999e-151 < y < 1.9e52Initial 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.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 59.6%
if 1.9e52 < 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.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 56.6%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2.85e-157) (/ (* x 0.5) t) (if (<= y 1.15e+52) (* -0.5 (/ z t)) (* 0.5 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.85e-157) {
tmp = (x * 0.5) / t;
} else if (y <= 1.15e+52) {
tmp = -0.5 * (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 <= (-2.85d-157)) then
tmp = (x * 0.5d0) / t
else if (y <= 1.15d+52) then
tmp = (-0.5d0) * (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 <= -2.85e-157) {
tmp = (x * 0.5) / t;
} else if (y <= 1.15e+52) {
tmp = -0.5 * (z / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.85e-157: tmp = (x * 0.5) / t elif y <= 1.15e+52: tmp = -0.5 * (z / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.85e-157) tmp = Float64(Float64(x * 0.5) / t); elseif (y <= 1.15e+52) tmp = Float64(-0.5 * Float64(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 <= -2.85e-157) tmp = (x * 0.5) / t; elseif (y <= 1.15e+52) tmp = -0.5 * (z / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.85e-157], N[(N[(x * 0.5), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 1.15e+52], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{-157}:\\
\;\;\;\;\frac{x \cdot 0.5}{t}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+52}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -2.84999999999999999e-157Initial program 99.0%
sub-neg99.0%
+-commutative99.0%
neg-sub099.0%
associate-+l-99.0%
sub0-neg99.0%
neg-mul-199.0%
associate-*l/98.7%
*-commutative98.7%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 37.6%
associate-*r/38.4%
Applied egg-rr38.4%
if -2.84999999999999999e-157 < y < 1.15e52Initial 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.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 59.2%
if 1.15e52 < 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.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 56.6%
Final simplification50.5%
(FPCore (x y z t) :precision binary64 (if (<= y 1.65e+52) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1.65e+52) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((x + 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.65d+52) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = 0.5d0 * ((x + 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.65e+52) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1.65e+52: tmp = 0.5 * ((x - z) / t) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1.65e+52) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(0.5 * Float64(Float64(x + y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1.65e+52) tmp = 0.5 * ((x - z) / t); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1.65e+52], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{+52}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if y < 1.65e52Initial program 99.5%
Taylor expanded in y around 0 78.7%
if 1.65e52 < 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.8%
*-commutative99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 86.0%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2.7e-60) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.7e-60) {
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 (x <= (-2.7d-60)) 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 (x <= -2.7e-60) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((y - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.7e-60: 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 (x <= -2.7e-60) 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 (x <= -2.7e-60) 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[x, -2.7e-60], 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}\;x \leq -2.7 \cdot 10^{-60}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if x < -2.7e-60Initial program 100.0%
Taylor expanded in y around 0 84.0%
if -2.7e-60 < x Initial program 99.4%
Taylor expanded in x around 0 76.6%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (if (<= x -2.6e+139) (* 0.5 (/ x t)) (* -0.5 (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e+139) {
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 (x <= (-2.6d+139)) 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 (x <= -2.6e+139) {
tmp = 0.5 * (x / t);
} else {
tmp = -0.5 * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.6e+139: tmp = 0.5 * (x / t) else: tmp = -0.5 * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.6e+139) 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 (x <= -2.6e+139) tmp = 0.5 * (x / t); else tmp = -0.5 * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.6e+139], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+139}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.60000000000000022e139Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 85.0%
if -2.60000000000000022e139 < x Initial program 99.5%
sub-neg99.5%
+-commutative99.5%
neg-sub099.5%
associate-+l-99.5%
sub0-neg99.5%
neg-mul-199.5%
associate-*l/99.2%
*-commutative99.2%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 45.9%
Final simplification52.8%
(FPCore (x y z t) :precision binary64 (* -0.5 (/ z t)))
double code(double x, double y, double z, double t) {
return -0.5 * (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 = (-0.5d0) * (z / t)
end function
public static double code(double x, double y, double z, double t) {
return -0.5 * (z / t);
}
def code(x, y, z, t): return -0.5 * (z / t)
function code(x, y, z, t) return Float64(-0.5 * Float64(z / t)) end
function tmp = code(x, y, z, t) tmp = -0.5 * (z / t); end
code[x_, y_, z_, t_] := N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{z}{t}
\end{array}
Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
associate-*l/99.3%
*-commutative99.3%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 39.2%
Final simplification39.2%
herbie shell --seed 2023196
(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)))