
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ x t))) (t_2 (* z (/ -0.5 t))))
(if (<= x -8.5e+138)
t_1
(if (<= x -2.2e+95)
t_2
(if (<= x -1.95e+31) t_1 (if (<= x 1.12e-297) t_2 (* 0.5 (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (x / t);
double t_2 = z * (-0.5 / t);
double tmp;
if (x <= -8.5e+138) {
tmp = t_1;
} else if (x <= -2.2e+95) {
tmp = t_2;
} else if (x <= -1.95e+31) {
tmp = t_1;
} else if (x <= 1.12e-297) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 0.5d0 * (x / t)
t_2 = z * ((-0.5d0) / t)
if (x <= (-8.5d+138)) then
tmp = t_1
else if (x <= (-2.2d+95)) then
tmp = t_2
else if (x <= (-1.95d+31)) then
tmp = t_1
else if (x <= 1.12d-297) then
tmp = t_2
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 t_1 = 0.5 * (x / t);
double t_2 = z * (-0.5 / t);
double tmp;
if (x <= -8.5e+138) {
tmp = t_1;
} else if (x <= -2.2e+95) {
tmp = t_2;
} else if (x <= -1.95e+31) {
tmp = t_1;
} else if (x <= 1.12e-297) {
tmp = t_2;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * (x / t) t_2 = z * (-0.5 / t) tmp = 0 if x <= -8.5e+138: tmp = t_1 elif x <= -2.2e+95: tmp = t_2 elif x <= -1.95e+31: tmp = t_1 elif x <= 1.12e-297: tmp = t_2 else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(x / t)) t_2 = Float64(z * Float64(-0.5 / t)) tmp = 0.0 if (x <= -8.5e+138) tmp = t_1; elseif (x <= -2.2e+95) tmp = t_2; elseif (x <= -1.95e+31) tmp = t_1; elseif (x <= 1.12e-297) tmp = t_2; else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * (x / t); t_2 = z * (-0.5 / t); tmp = 0.0; if (x <= -8.5e+138) tmp = t_1; elseif (x <= -2.2e+95) tmp = t_2; elseif (x <= -1.95e+31) tmp = t_1; elseif (x <= 1.12e-297) tmp = t_2; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.5e+138], t$95$1, If[LessEqual[x, -2.2e+95], t$95$2, If[LessEqual[x, -1.95e+31], t$95$1, If[LessEqual[x, 1.12e-297], t$95$2, N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x}{t}\\
t_2 := z \cdot \frac{-0.5}{t}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{+95}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.95 \cdot 10^{+31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-297}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -8.5000000000000006e138 or -2.1999999999999999e95 < x < -1.95e31Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 76.3%
if -8.5000000000000006e138 < x < -2.1999999999999999e95 or -1.95e31 < x < 1.11999999999999997e-297Initial 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%
sub-neg99.6%
distribute-lft-in93.4%
fma-def95.9%
Applied egg-rr95.9%
Taylor expanded in z around inf 55.2%
associate-*r/55.2%
associate-*l/55.0%
*-commutative55.0%
Simplified55.0%
if 1.11999999999999997e-297 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 40.3%
Final simplification53.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ x t))) (t_2 (/ z (/ t -0.5))))
(if (<= x -8.5e+138)
t_1
(if (<= x -1.5e+95)
t_2
(if (<= x -1.26e+31) t_1 (if (<= x 8.6e-308) t_2 (* 0.5 (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * (x / t);
double t_2 = z / (t / -0.5);
double tmp;
if (x <= -8.5e+138) {
tmp = t_1;
} else if (x <= -1.5e+95) {
tmp = t_2;
} else if (x <= -1.26e+31) {
tmp = t_1;
} else if (x <= 8.6e-308) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 0.5d0 * (x / t)
t_2 = z / (t / (-0.5d0))
if (x <= (-8.5d+138)) then
tmp = t_1
else if (x <= (-1.5d+95)) then
tmp = t_2
else if (x <= (-1.26d+31)) then
tmp = t_1
else if (x <= 8.6d-308) then
tmp = t_2
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 t_1 = 0.5 * (x / t);
double t_2 = z / (t / -0.5);
double tmp;
if (x <= -8.5e+138) {
tmp = t_1;
} else if (x <= -1.5e+95) {
tmp = t_2;
} else if (x <= -1.26e+31) {
tmp = t_1;
} else if (x <= 8.6e-308) {
tmp = t_2;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * (x / t) t_2 = z / (t / -0.5) tmp = 0 if x <= -8.5e+138: tmp = t_1 elif x <= -1.5e+95: tmp = t_2 elif x <= -1.26e+31: tmp = t_1 elif x <= 8.6e-308: tmp = t_2 else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(x / t)) t_2 = Float64(z / Float64(t / -0.5)) tmp = 0.0 if (x <= -8.5e+138) tmp = t_1; elseif (x <= -1.5e+95) tmp = t_2; elseif (x <= -1.26e+31) tmp = t_1; elseif (x <= 8.6e-308) tmp = t_2; else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * (x / t); t_2 = z / (t / -0.5); tmp = 0.0; if (x <= -8.5e+138) tmp = t_1; elseif (x <= -1.5e+95) tmp = t_2; elseif (x <= -1.26e+31) tmp = t_1; elseif (x <= 8.6e-308) tmp = t_2; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.5e+138], t$95$1, If[LessEqual[x, -1.5e+95], t$95$2, If[LessEqual[x, -1.26e+31], t$95$1, If[LessEqual[x, 8.6e-308], t$95$2, N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x}{t}\\
t_2 := \frac{z}{\frac{t}{-0.5}}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{+95}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.26 \cdot 10^{+31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-308}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -8.5000000000000006e138 or -1.49999999999999996e95 < x < -1.26000000000000001e31Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 76.3%
if -8.5000000000000006e138 < x < -1.49999999999999996e95 or -1.26000000000000001e31 < x < 8.60000000000000041e-308Initial 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 55.2%
*-commutative55.2%
associate-/r/55.2%
Simplified55.2%
if 8.60000000000000041e-308 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.6%
*-commutative99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around inf 40.3%
Final simplification53.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.1e+181) (not (<= z 1.9e+99))) (/ z (/ t -0.5)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.1e+181) || !(z <= 1.9e+99)) {
tmp = z / (t / -0.5);
} 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 <= (-1.1d+181)) .or. (.not. (z <= 1.9d+99))) then
tmp = z / (t / (-0.5d0))
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 <= -1.1e+181) || !(z <= 1.9e+99)) {
tmp = z / (t / -0.5);
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.1e+181) or not (z <= 1.9e+99): tmp = z / (t / -0.5) else: tmp = 0.5 * ((x + y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.1e+181) || !(z <= 1.9e+99)) tmp = Float64(z / Float64(t / -0.5)); 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 <= -1.1e+181) || ~((z <= 1.9e+99))) tmp = z / (t / -0.5); else tmp = 0.5 * ((x + y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.1e+181], N[Not[LessEqual[z, 1.9e+99]], $MachinePrecision]], N[(z / N[(t / -0.5), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+181} \lor \neg \left(z \leq 1.9 \cdot 10^{+99}\right):\\
\;\;\;\;\frac{z}{\frac{t}{-0.5}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -1.1000000000000001e181 or 1.9e99 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 76.4%
*-commutative76.4%
associate-/r/76.4%
Simplified76.4%
if -1.1000000000000001e181 < z < 1.9e99Initial 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 87.6%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (<= y 7.2e+32) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 7.2e+32) {
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 <= 7.2d+32) 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 <= 7.2e+32) {
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 <= 7.2e+32: 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 <= 7.2e+32) 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 <= 7.2e+32) 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, 7.2e+32], 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 7.2 \cdot 10^{+32}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if y < 7.1999999999999994e32Initial program 100.0%
Taylor expanded in y around 0 76.5%
if 7.1999999999999994e32 < y Initial 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 z around 0 85.6%
Final simplification78.6%
(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 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (<= y 4.8e+43) (* 0.5 (/ x t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e+43) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 4.8d+43) then
tmp = 0.5d0 * (x / t)
else
tmp = 0.5d0 * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 4.8e+43) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 4.8e+43: tmp = 0.5 * (x / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 4.8e+43) tmp = Float64(0.5 * Float64(x / t)); else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 4.8e+43) tmp = 0.5 * (x / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 4.8e+43], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{+43}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 4.80000000000000046e43Initial 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 x around inf 43.4%
if 4.80000000000000046e43 < y Initial 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.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 63.6%
Final simplification47.9%
(FPCore (x y z t) :precision binary64 (* 0.5 (/ x t)))
double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.5d0 * (x / t)
end function
public static double code(double x, double y, double z, double t) {
return 0.5 * (x / t);
}
def code(x, y, z, t): return 0.5 * (x / t)
function code(x, y, z, t) return Float64(0.5 * Float64(x / t)) end
function tmp = code(x, y, z, t) tmp = 0.5 * (x / t); end
code[x_, y_, z_, t_] := N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \frac{x}{t}
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub0-neg100.0%
neg-mul-1100.0%
associate-*l/99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 39.6%
Final simplification39.6%
herbie shell --seed 2023240
(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)))