
(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 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + y) - z) / (t * 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x + y) - z) / (t * 2.0);
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
function code(x, y, z, t) return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x + y) - z) / (t * 2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x + y\right) - z}{t \cdot 2}
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) -0.5)) (t_2 (/ x (* t 2.0))))
(if (<= y 6.4e-260)
t_2
(if (<= y 2.8e-235)
t_1
(if (<= y 9.6e-202) t_2 (if (<= y 0.43) t_1 (/ y (* t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -0.5;
double t_2 = x / (t * 2.0);
double tmp;
if (y <= 6.4e-260) {
tmp = t_2;
} else if (y <= 2.8e-235) {
tmp = t_1;
} else if (y <= 9.6e-202) {
tmp = t_2;
} else if (y <= 0.43) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z / t) * (-0.5d0)
t_2 = x / (t * 2.0d0)
if (y <= 6.4d-260) then
tmp = t_2
else if (y <= 2.8d-235) then
tmp = t_1
else if (y <= 9.6d-202) then
tmp = t_2
else if (y <= 0.43d0) then
tmp = t_1
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 t_1 = (z / t) * -0.5;
double t_2 = x / (t * 2.0);
double tmp;
if (y <= 6.4e-260) {
tmp = t_2;
} else if (y <= 2.8e-235) {
tmp = t_1;
} else if (y <= 9.6e-202) {
tmp = t_2;
} else if (y <= 0.43) {
tmp = t_1;
} else {
tmp = y / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * -0.5 t_2 = x / (t * 2.0) tmp = 0 if y <= 6.4e-260: tmp = t_2 elif y <= 2.8e-235: tmp = t_1 elif y <= 9.6e-202: tmp = t_2 elif y <= 0.43: tmp = t_1 else: tmp = y / (t * 2.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * -0.5) t_2 = Float64(x / Float64(t * 2.0)) tmp = 0.0 if (y <= 6.4e-260) tmp = t_2; elseif (y <= 2.8e-235) tmp = t_1; elseif (y <= 9.6e-202) tmp = t_2; elseif (y <= 0.43) tmp = t_1; else tmp = Float64(y / Float64(t * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * -0.5; t_2 = x / (t * 2.0); tmp = 0.0; if (y <= 6.4e-260) tmp = t_2; elseif (y <= 2.8e-235) tmp = t_1; elseif (y <= 9.6e-202) tmp = t_2; elseif (y <= 0.43) tmp = t_1; else tmp = y / (t * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.4e-260], t$95$2, If[LessEqual[y, 2.8e-235], t$95$1, If[LessEqual[y, 9.6e-202], t$95$2, If[LessEqual[y, 0.43], t$95$1, N[(y / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot -0.5\\
t_2 := \frac{x}{t \cdot 2}\\
\mathbf{if}\;y \leq 6.4 \cdot 10^{-260}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-235}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{-202}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 0.43:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t \cdot 2}\\
\end{array}
\end{array}
if y < 6.3999999999999999e-260 or 2.79999999999999995e-235 < y < 9.6000000000000004e-202Initial program 100.0%
Taylor expanded in x around inf 39.5%
if 6.3999999999999999e-260 < y < 2.79999999999999995e-235 or 9.6000000000000004e-202 < y < 0.429999999999999993Initial program 100.0%
Taylor expanded in z around inf 61.6%
*-commutative61.6%
Simplified61.6%
if 0.429999999999999993 < y Initial program 100.0%
Taylor expanded in y around inf 55.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) -0.5)) (t_2 (/ x (* t 2.0))))
(if (<= y 4.1e-259)
t_2
(if (<= y 6.4e-232)
t_1
(if (<= y 8.6e-202) t_2 (if (<= y 0.145) t_1 (* y (/ 0.5 t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -0.5;
double t_2 = x / (t * 2.0);
double tmp;
if (y <= 4.1e-259) {
tmp = t_2;
} else if (y <= 6.4e-232) {
tmp = t_1;
} else if (y <= 8.6e-202) {
tmp = t_2;
} else if (y <= 0.145) {
tmp = t_1;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z / t) * (-0.5d0)
t_2 = x / (t * 2.0d0)
if (y <= 4.1d-259) then
tmp = t_2
else if (y <= 6.4d-232) then
tmp = t_1
else if (y <= 8.6d-202) then
tmp = t_2
else if (y <= 0.145d0) then
tmp = t_1
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -0.5;
double t_2 = x / (t * 2.0);
double tmp;
if (y <= 4.1e-259) {
tmp = t_2;
} else if (y <= 6.4e-232) {
tmp = t_1;
} else if (y <= 8.6e-202) {
tmp = t_2;
} else if (y <= 0.145) {
tmp = t_1;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * -0.5 t_2 = x / (t * 2.0) tmp = 0 if y <= 4.1e-259: tmp = t_2 elif y <= 6.4e-232: tmp = t_1 elif y <= 8.6e-202: tmp = t_2 elif y <= 0.145: tmp = t_1 else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * -0.5) t_2 = Float64(x / Float64(t * 2.0)) tmp = 0.0 if (y <= 4.1e-259) tmp = t_2; elseif (y <= 6.4e-232) tmp = t_1; elseif (y <= 8.6e-202) tmp = t_2; elseif (y <= 0.145) tmp = t_1; else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * -0.5; t_2 = x / (t * 2.0); tmp = 0.0; if (y <= 4.1e-259) tmp = t_2; elseif (y <= 6.4e-232) tmp = t_1; elseif (y <= 8.6e-202) tmp = t_2; elseif (y <= 0.145) tmp = t_1; else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4.1e-259], t$95$2, If[LessEqual[y, 6.4e-232], t$95$1, If[LessEqual[y, 8.6e-202], t$95$2, If[LessEqual[y, 0.145], t$95$1, N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot -0.5\\
t_2 := \frac{x}{t \cdot 2}\\
\mathbf{if}\;y \leq 4.1 \cdot 10^{-259}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-202}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 0.145:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 4.0999999999999998e-259 or 6.39999999999999973e-232 < y < 8.59999999999999986e-202Initial program 100.0%
Taylor expanded in x around inf 39.5%
if 4.0999999999999998e-259 < y < 6.39999999999999973e-232 or 8.59999999999999986e-202 < y < 0.14499999999999999Initial program 100.0%
Taylor expanded in z around inf 61.6%
*-commutative61.6%
Simplified61.6%
if 0.14499999999999999 < y Initial program 100.0%
div-sub92.3%
div-inv92.0%
*-commutative92.0%
associate-/r*92.0%
metadata-eval92.0%
div-inv92.0%
*-commutative92.0%
associate-/r*92.0%
metadata-eval92.0%
Applied egg-rr92.0%
Taylor expanded in y around inf 55.3%
associate-*r/55.3%
associate-*l/55.2%
*-commutative55.2%
Simplified55.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) -0.5)) (t_2 (* x (/ 0.5 t))))
(if (<= y 4e-300)
t_2
(if (<= y 1.65e-237)
t_1
(if (<= y 6.8e-202) t_2 (if (<= y 0.29) t_1 (* y (/ 0.5 t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -0.5;
double t_2 = x * (0.5 / t);
double tmp;
if (y <= 4e-300) {
tmp = t_2;
} else if (y <= 1.65e-237) {
tmp = t_1;
} else if (y <= 6.8e-202) {
tmp = t_2;
} else if (y <= 0.29) {
tmp = t_1;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z / t) * (-0.5d0)
t_2 = x * (0.5d0 / t)
if (y <= 4d-300) then
tmp = t_2
else if (y <= 1.65d-237) then
tmp = t_1
else if (y <= 6.8d-202) then
tmp = t_2
else if (y <= 0.29d0) then
tmp = t_1
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -0.5;
double t_2 = x * (0.5 / t);
double tmp;
if (y <= 4e-300) {
tmp = t_2;
} else if (y <= 1.65e-237) {
tmp = t_1;
} else if (y <= 6.8e-202) {
tmp = t_2;
} else if (y <= 0.29) {
tmp = t_1;
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * -0.5 t_2 = x * (0.5 / t) tmp = 0 if y <= 4e-300: tmp = t_2 elif y <= 1.65e-237: tmp = t_1 elif y <= 6.8e-202: tmp = t_2 elif y <= 0.29: tmp = t_1 else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * -0.5) t_2 = Float64(x * Float64(0.5 / t)) tmp = 0.0 if (y <= 4e-300) tmp = t_2; elseif (y <= 1.65e-237) tmp = t_1; elseif (y <= 6.8e-202) tmp = t_2; elseif (y <= 0.29) tmp = t_1; else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * -0.5; t_2 = x * (0.5 / t); tmp = 0.0; if (y <= 4e-300) tmp = t_2; elseif (y <= 1.65e-237) tmp = t_1; elseif (y <= 6.8e-202) tmp = t_2; elseif (y <= 0.29) tmp = t_1; else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4e-300], t$95$2, If[LessEqual[y, 1.65e-237], t$95$1, If[LessEqual[y, 6.8e-202], t$95$2, If[LessEqual[y, 0.29], t$95$1, N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot -0.5\\
t_2 := x \cdot \frac{0.5}{t}\\
\mathbf{if}\;y \leq 4 \cdot 10^{-300}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-237}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-202}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 0.29:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 4.0000000000000001e-300 or 1.6500000000000001e-237 < y < 6.80000000000000025e-202Initial program 99.9%
div-sub94.5%
div-inv94.3%
*-commutative94.3%
associate-/r*94.3%
metadata-eval94.3%
div-inv94.2%
*-commutative94.2%
associate-/r*94.2%
metadata-eval94.2%
Applied egg-rr94.2%
Taylor expanded in x around inf 37.2%
associate-*r/37.2%
associate-*l/37.0%
*-commutative37.0%
Simplified37.0%
if 4.0000000000000001e-300 < y < 1.6500000000000001e-237 or 6.80000000000000025e-202 < y < 0.28999999999999998Initial program 100.0%
Taylor expanded in z around inf 56.0%
*-commutative56.0%
Simplified56.0%
if 0.28999999999999998 < y Initial program 100.0%
div-sub92.3%
div-inv92.0%
*-commutative92.0%
associate-/r*92.0%
metadata-eval92.0%
div-inv92.0%
*-commutative92.0%
associate-/r*92.0%
metadata-eval92.0%
Applied egg-rr92.0%
Taylor expanded in y around inf 55.3%
associate-*r/55.3%
associate-*l/55.2%
*-commutative55.2%
Simplified55.2%
(FPCore (x y z t) :precision binary64 (if (<= y 2.22e-20) (/ (- x z) (* t 2.0)) (/ (- y z) (* t 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.22e-20) {
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 (y <= 2.22d-20) 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 (y <= 2.22e-20) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = (y - z) / (t * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.22e-20: 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 (y <= 2.22e-20) 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 (y <= 2.22e-20) 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[y, 2.22e-20], 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}\;y \leq 2.22 \cdot 10^{-20}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{t \cdot 2}\\
\end{array}
\end{array}
if y < 2.21999999999999997e-20Initial program 100.0%
Taylor expanded in y around 0 75.1%
if 2.21999999999999997e-20 < y Initial program 100.0%
Taylor expanded in x around 0 69.5%
(FPCore (x y z t) :precision binary64 (if (<= y 5.6e-14) (/ (- x z) (* t 2.0)) (/ 0.5 (/ t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 5.6e-14) {
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 (y <= 5.6d-14) 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 (y <= 5.6e-14) {
tmp = (x - z) / (t * 2.0);
} else {
tmp = 0.5 / (t / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 5.6e-14: 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 (y <= 5.6e-14) tmp = Float64(Float64(x - z) / Float64(t * 2.0)); else tmp = Float64(0.5 / Float64(t / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 5.6e-14) 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[y, 5.6e-14], N[(N[(x - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6 \cdot 10^{-14}:\\
\;\;\;\;\frac{x - z}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y - z}}\\
\end{array}
\end{array}
if y < 5.6000000000000001e-14Initial program 100.0%
Taylor expanded in y around 0 75.4%
if 5.6000000000000001e-14 < y Initial program 100.0%
Taylor expanded in x around 0 68.4%
Taylor expanded in y around 0 64.7%
metadata-eval64.7%
associate-*r*64.7%
mul-1-neg64.7%
distribute-frac-neg64.7%
+-commutative64.7%
distribute-lft-out64.7%
distribute-frac-neg64.7%
sub-neg64.7%
div-sub68.4%
*-lft-identity68.4%
associate-*l/68.3%
associate-/r/68.2%
associate-*r/68.2%
metadata-eval68.2%
Simplified68.2%
(FPCore (x y z t) :precision binary64 (if (<= x -2.05e-38) (/ (+ x y) (* t 2.0)) (/ 0.5 (/ t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.05e-38) {
tmp = (x + y) / (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 <= (-2.05d-38)) then
tmp = (x + y) / (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 <= -2.05e-38) {
tmp = (x + y) / (t * 2.0);
} else {
tmp = 0.5 / (t / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.05e-38: tmp = (x + y) / (t * 2.0) else: tmp = 0.5 / (t / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.05e-38) tmp = Float64(Float64(x + y) / Float64(t * 2.0)); else tmp = Float64(0.5 / Float64(t / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.05e-38) tmp = (x + y) / (t * 2.0); else tmp = 0.5 / (t / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.05e-38], N[(N[(x + y), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-38}:\\
\;\;\;\;\frac{x + y}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y - z}}\\
\end{array}
\end{array}
if x < -2.0499999999999999e-38Initial program 100.0%
Taylor expanded in z around 0 77.0%
+-commutative77.0%
Simplified77.0%
if -2.0499999999999999e-38 < x Initial program 100.0%
Taylor expanded in x around 0 73.7%
Taylor expanded in y around 0 69.4%
metadata-eval69.4%
associate-*r*69.4%
mul-1-neg69.4%
distribute-frac-neg69.4%
+-commutative69.4%
distribute-lft-out69.4%
distribute-frac-neg69.4%
sub-neg69.4%
div-sub73.7%
*-lft-identity73.7%
associate-*l/73.5%
associate-/r/73.5%
associate-*r/73.5%
metadata-eval73.5%
Simplified73.5%
Final simplification74.4%
(FPCore (x y z t) :precision binary64 (if (<= x -6e+82) (/ x (* t 2.0)) (/ 0.5 (/ t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6e+82) {
tmp = x / (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 <= (-6d+82)) then
tmp = x / (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 <= -6e+82) {
tmp = x / (t * 2.0);
} else {
tmp = 0.5 / (t / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6e+82: tmp = x / (t * 2.0) else: tmp = 0.5 / (t / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6e+82) tmp = Float64(x / Float64(t * 2.0)); else tmp = Float64(0.5 / Float64(t / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6e+82) tmp = x / (t * 2.0); else tmp = 0.5 / (t / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6e+82], N[(x / N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{t \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{t}{y - z}}\\
\end{array}
\end{array}
if x < -5.99999999999999978e82Initial program 99.9%
Taylor expanded in x around inf 71.6%
if -5.99999999999999978e82 < x Initial program 100.0%
Taylor expanded in x around 0 72.8%
Taylor expanded in y around 0 69.1%
metadata-eval69.1%
associate-*r*69.1%
mul-1-neg69.1%
distribute-frac-neg69.1%
+-commutative69.1%
distribute-lft-out69.1%
distribute-frac-neg69.1%
sub-neg69.1%
div-sub72.8%
*-lft-identity72.8%
associate-*l/72.6%
associate-/r/72.6%
associate-*r/72.6%
metadata-eval72.6%
Simplified72.6%
(FPCore (x y z t) :precision binary64 (if (<= y 2.05e-17) (* x (/ 0.5 t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e-17) {
tmp = x * (0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 2.05d-17) then
tmp = x * (0.5d0 / t)
else
tmp = y * (0.5d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.05e-17) {
tmp = x * (0.5 / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.05e-17: tmp = x * (0.5 / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.05e-17) tmp = Float64(x * Float64(0.5 / t)); else tmp = Float64(y * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 2.05e-17) tmp = x * (0.5 / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.05e-17], N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.05 \cdot 10^{-17}:\\
\;\;\;\;x \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 2.05e-17Initial program 100.0%
div-sub95.5%
div-inv95.3%
*-commutative95.3%
associate-/r*95.3%
metadata-eval95.3%
div-inv95.1%
*-commutative95.1%
associate-/r*95.1%
metadata-eval95.1%
Applied egg-rr95.1%
Taylor expanded in x around inf 40.2%
associate-*r/40.2%
associate-*l/40.0%
*-commutative40.0%
Simplified40.0%
if 2.05e-17 < y Initial program 100.0%
div-sub92.8%
div-inv92.6%
*-commutative92.6%
associate-/r*92.6%
metadata-eval92.6%
div-inv92.6%
*-commutative92.6%
associate-/r*92.6%
metadata-eval92.6%
Applied egg-rr92.6%
Taylor expanded in y around inf 51.7%
associate-*r/51.7%
associate-*l/51.6%
*-commutative51.6%
Simplified51.6%
(FPCore (x y z t) :precision binary64 (* x (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return x * (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 = x * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return x * (0.5 / t);
}
def code(x, y, z, t): return x * (0.5 / t)
function code(x, y, z, t) return Float64(x * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = x * (0.5 / t); end
code[x_, y_, z_, t_] := N[(x * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
div-sub94.9%
div-inv94.7%
*-commutative94.7%
associate-/r*94.7%
metadata-eval94.7%
div-inv94.6%
*-commutative94.6%
associate-/r*94.6%
metadata-eval94.6%
Applied egg-rr94.6%
Taylor expanded in x around inf 39.1%
associate-*r/39.1%
associate-*l/39.0%
*-commutative39.0%
Simplified39.0%
herbie shell --seed 2024100
(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)))