
(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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -5.2e+170)
(not (or (<= z -6e+99) (and (not (<= z -2.4e+61)) (<= z 3.7e+105)))))
(* (/ z t) -0.5)
(* 0.5 (/ (+ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+170) || !((z <= -6e+99) || (!(z <= -2.4e+61) && (z <= 3.7e+105)))) {
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 <= (-5.2d+170)) .or. (.not. (z <= (-6d+99)) .or. (.not. (z <= (-2.4d+61))) .and. (z <= 3.7d+105))) 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 <= -5.2e+170) || !((z <= -6e+99) || (!(z <= -2.4e+61) && (z <= 3.7e+105)))) {
tmp = (z / t) * -0.5;
} else {
tmp = 0.5 * ((x + y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e+170) or not ((z <= -6e+99) or (not (z <= -2.4e+61) and (z <= 3.7e+105))): 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 <= -5.2e+170) || !((z <= -6e+99) || (!(z <= -2.4e+61) && (z <= 3.7e+105)))) tmp = Float64(Float64(z / 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 <= -5.2e+170) || ~(((z <= -6e+99) || (~((z <= -2.4e+61)) && (z <= 3.7e+105))))) 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, -5.2e+170], N[Not[Or[LessEqual[z, -6e+99], And[N[Not[LessEqual[z, -2.4e+61]], $MachinePrecision], LessEqual[z, 3.7e+105]]]], $MachinePrecision]], N[(N[(z / t), $MachinePrecision] * -0.5), $MachinePrecision], N[(0.5 * N[(N[(x + y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+170} \lor \neg \left(z \leq -6 \cdot 10^{+99} \lor \neg \left(z \leq -2.4 \cdot 10^{+61}\right) \land z \leq 3.7 \cdot 10^{+105}\right):\\
\;\;\;\;\frac{z}{t} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x + y}{t}\\
\end{array}
\end{array}
if z < -5.1999999999999996e170 or -6.00000000000000029e99 < z < -2.3999999999999999e61 or 3.69999999999999985e105 < z Initial program 100.0%
Taylor expanded in z around inf 77.3%
*-commutative77.3%
Simplified77.3%
if -5.1999999999999996e170 < z < -6.00000000000000029e99 or -2.3999999999999999e61 < z < 3.69999999999999985e105Initial program 100.0%
Taylor expanded in z around 0 87.2%
+-commutative87.2%
Simplified87.2%
Final simplification83.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ -0.5 t))) (t_2 (* 0.5 (/ x t))))
(if (<= y -6.5e-148)
t_2
(if (<= y -1.25e-212)
t_1
(if (<= y 1.12e-272) t_2 (if (<= y 1.45e+26) t_1 (* 0.5 (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (-0.5 / t);
double t_2 = 0.5 * (x / t);
double tmp;
if (y <= -6.5e-148) {
tmp = t_2;
} else if (y <= -1.25e-212) {
tmp = t_1;
} else if (y <= 1.12e-272) {
tmp = t_2;
} else if (y <= 1.45e+26) {
tmp = t_1;
} 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 = z * ((-0.5d0) / t)
t_2 = 0.5d0 * (x / t)
if (y <= (-6.5d-148)) then
tmp = t_2
else if (y <= (-1.25d-212)) then
tmp = t_1
else if (y <= 1.12d-272) then
tmp = t_2
else if (y <= 1.45d+26) then
tmp = t_1
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 = z * (-0.5 / t);
double t_2 = 0.5 * (x / t);
double tmp;
if (y <= -6.5e-148) {
tmp = t_2;
} else if (y <= -1.25e-212) {
tmp = t_1;
} else if (y <= 1.12e-272) {
tmp = t_2;
} else if (y <= 1.45e+26) {
tmp = t_1;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (-0.5 / t) t_2 = 0.5 * (x / t) tmp = 0 if y <= -6.5e-148: tmp = t_2 elif y <= -1.25e-212: tmp = t_1 elif y <= 1.12e-272: tmp = t_2 elif y <= 1.45e+26: tmp = t_1 else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-0.5 / t)) t_2 = Float64(0.5 * Float64(x / t)) tmp = 0.0 if (y <= -6.5e-148) tmp = t_2; elseif (y <= -1.25e-212) tmp = t_1; elseif (y <= 1.12e-272) tmp = t_2; elseif (y <= 1.45e+26) tmp = t_1; else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (-0.5 / t); t_2 = 0.5 * (x / t); tmp = 0.0; if (y <= -6.5e-148) tmp = t_2; elseif (y <= -1.25e-212) tmp = t_1; elseif (y <= 1.12e-272) tmp = t_2; elseif (y <= 1.45e+26) tmp = t_1; else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e-148], t$95$2, If[LessEqual[y, -1.25e-212], t$95$1, If[LessEqual[y, 1.12e-272], t$95$2, If[LessEqual[y, 1.45e+26], t$95$1, N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-0.5}{t}\\
t_2 := 0.5 \cdot \frac{x}{t}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{-148}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.25 \cdot 10^{-212}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{-272}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -6.4999999999999997e-148 or -1.25000000000000011e-212 < y < 1.11999999999999994e-272Initial program 100.0%
Taylor expanded in x around inf 41.4%
if -6.4999999999999997e-148 < y < -1.25000000000000011e-212 or 1.11999999999999994e-272 < y < 1.45e26Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
associate-*l/99.9%
associate-*r/99.9%
associate-*l/99.7%
distribute-lft-in99.7%
associate-+r-99.7%
sub-neg99.7%
+-commutative99.7%
associate-+l+99.7%
sub-neg99.7%
Simplified99.7%
Taylor expanded in z around inf 55.4%
associate-*r/55.4%
associate-/l*55.3%
Simplified55.3%
associate-/r/55.3%
Applied egg-rr55.3%
if 1.45e26 < y Initial program 100.0%
Taylor expanded in y around inf 66.0%
Final simplification53.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) -0.5)) (t_2 (* 0.5 (/ x t))))
(if (<= y -5.8e-148)
t_2
(if (<= y -1.45e-198)
t_1
(if (<= y 5.5e-272) t_2 (if (<= y 7.8e+26) t_1 (* 0.5 (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * -0.5;
double t_2 = 0.5 * (x / t);
double tmp;
if (y <= -5.8e-148) {
tmp = t_2;
} else if (y <= -1.45e-198) {
tmp = t_1;
} else if (y <= 5.5e-272) {
tmp = t_2;
} else if (y <= 7.8e+26) {
tmp = t_1;
} 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 = (z / t) * (-0.5d0)
t_2 = 0.5d0 * (x / t)
if (y <= (-5.8d-148)) then
tmp = t_2
else if (y <= (-1.45d-198)) then
tmp = t_1
else if (y <= 5.5d-272) then
tmp = t_2
else if (y <= 7.8d+26) then
tmp = t_1
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 = (z / t) * -0.5;
double t_2 = 0.5 * (x / t);
double tmp;
if (y <= -5.8e-148) {
tmp = t_2;
} else if (y <= -1.45e-198) {
tmp = t_1;
} else if (y <= 5.5e-272) {
tmp = t_2;
} else if (y <= 7.8e+26) {
tmp = t_1;
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * -0.5 t_2 = 0.5 * (x / t) tmp = 0 if y <= -5.8e-148: tmp = t_2 elif y <= -1.45e-198: tmp = t_1 elif y <= 5.5e-272: tmp = t_2 elif y <= 7.8e+26: tmp = t_1 else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * -0.5) t_2 = Float64(0.5 * Float64(x / t)) tmp = 0.0 if (y <= -5.8e-148) tmp = t_2; elseif (y <= -1.45e-198) tmp = t_1; elseif (y <= 5.5e-272) tmp = t_2; elseif (y <= 7.8e+26) tmp = t_1; else tmp = Float64(0.5 * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * -0.5; t_2 = 0.5 * (x / t); tmp = 0.0; if (y <= -5.8e-148) tmp = t_2; elseif (y <= -1.45e-198) tmp = t_1; elseif (y <= 5.5e-272) tmp = t_2; elseif (y <= 7.8e+26) tmp = t_1; else tmp = 0.5 * (y / 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[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e-148], t$95$2, If[LessEqual[y, -1.45e-198], t$95$1, If[LessEqual[y, 5.5e-272], t$95$2, If[LessEqual[y, 7.8e+26], t$95$1, N[(0.5 * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot -0.5\\
t_2 := 0.5 \cdot \frac{x}{t}\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{-148}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-198}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-272}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -5.7999999999999997e-148 or -1.45e-198 < y < 5.4999999999999999e-272Initial program 100.0%
Taylor expanded in x around inf 40.6%
if -5.7999999999999997e-148 < y < -1.45e-198 or 5.4999999999999999e-272 < y < 7.8e26Initial program 100.0%
Taylor expanded in z around inf 55.1%
*-commutative55.1%
Simplified55.1%
if 7.8e26 < y Initial program 100.0%
Taylor expanded in y around inf 66.0%
Final simplification52.5%
(FPCore (x y z t) :precision binary64 (if (<= y 1.95e+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 <= 1.95e+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 <= 1.95d+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 <= 1.95e+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 <= 1.95e+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 <= 1.95e+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 <= 1.95e+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, 1.95e+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 1.95 \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 < 1.95e32Initial program 100.0%
Taylor expanded in y around 0 82.4%
if 1.95e32 < y Initial program 100.0%
Taylor expanded in z around 0 86.4%
+-commutative86.4%
Simplified86.4%
Final simplification83.5%
(FPCore (x y z t) :precision binary64 (if (<= y 1060000000.0) (* 0.5 (/ (- x z) t)) (* 0.5 (/ (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1060000000.0) {
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 (y <= 1060000000.0d0) 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 (y <= 1060000000.0) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = 0.5 * ((y - z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1060000000.0: 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 (y <= 1060000000.0) 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 (y <= 1060000000.0) 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[y, 1060000000.0], 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}\;y \leq 1060000000:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y - z}{t}\\
\end{array}
\end{array}
if y < 1.06e9Initial program 100.0%
Taylor expanded in y around 0 83.0%
if 1.06e9 < y Initial program 100.0%
Taylor expanded in x around 0 81.0%
Final simplification82.5%
(FPCore (x y z t) :precision binary64 (* (+ y (- x z)) (/ 0.5 t)))
double code(double x, double y, double z, double t) {
return (y + (x - z)) * (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 = (y + (x - z)) * (0.5d0 / t)
end function
public static double code(double x, double y, double z, double t) {
return (y + (x - z)) * (0.5 / t);
}
def code(x, y, z, t): return (y + (x - z)) * (0.5 / t)
function code(x, y, z, t) return Float64(Float64(y + Float64(x - z)) * Float64(0.5 / t)) end
function tmp = code(x, y, z, t) tmp = (y + (x - z)) * (0.5 / t); end
code[x_, y_, z_, t_] := N[(N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \left(x - z\right)\right) \cdot \frac{0.5}{t}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 98.0%
associate-*r/98.0%
associate-*l/97.9%
associate-*r/97.9%
associate-*l/97.7%
distribute-lft-in99.6%
associate-+r-99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
sub-neg99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (/ 0.5 (/ t (+ y (- x z)))))
double code(double x, double y, double z, double t) {
return 0.5 / (t / (y + (x - 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 / (y + (x - z)))
end function
public static double code(double x, double y, double z, double t) {
return 0.5 / (t / (y + (x - z)));
}
def code(x, y, z, t): return 0.5 / (t / (y + (x - z)))
function code(x, y, z, t) return Float64(0.5 / Float64(t / Float64(y + Float64(x - z)))) end
function tmp = code(x, y, z, t) tmp = 0.5 / (t / (y + (x - z))); end
code[x_, y_, z_, t_] := N[(0.5 / N[(t / N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{\frac{t}{y + \left(x - z\right)}}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 98.0%
associate-*r/98.0%
associate-*l/97.9%
associate-*r/97.9%
associate-*l/97.7%
distribute-lft-in99.6%
associate-+r-99.6%
sub-neg99.6%
+-commutative99.6%
associate-+l+99.6%
sub-neg99.6%
Simplified99.6%
associate-*l/100.0%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (<= y 2.2e+23) (* 0.5 (/ x t)) (* 0.5 (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.2e+23) {
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 <= 2.2d+23) 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 <= 2.2e+23) {
tmp = 0.5 * (x / t);
} else {
tmp = 0.5 * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 2.2e+23: tmp = 0.5 * (x / t) else: tmp = 0.5 * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 2.2e+23) 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 <= 2.2e+23) tmp = 0.5 * (x / t); else tmp = 0.5 * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.2e+23], 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 2.2 \cdot 10^{+23}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < 2.20000000000000008e23Initial program 100.0%
Taylor expanded in x around inf 42.9%
if 2.20000000000000008e23 < y Initial program 100.0%
Taylor expanded in y around inf 65.6%
Final simplification49.6%
(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%
Taylor expanded in x around inf 36.5%
Final simplification36.5%
herbie shell --seed 2023275
(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)))