
(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 (<= x -6.3e-19)
(* 0.5 (/ x t))
(if (or (<= x -3.7e-88)
(and (not (<= x -1.85e-292))
(or (<= x 2.2e-144) (not (<= x 7.5e-98)))))
(* y (/ 0.5 t))
(* z (/ -0.5 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.3e-19) {
tmp = 0.5 * (x / t);
} else if ((x <= -3.7e-88) || (!(x <= -1.85e-292) && ((x <= 2.2e-144) || !(x <= 7.5e-98)))) {
tmp = y * (0.5 / t);
} else {
tmp = z * (-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 <= (-6.3d-19)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-3.7d-88)) .or. (.not. (x <= (-1.85d-292))) .and. (x <= 2.2d-144) .or. (.not. (x <= 7.5d-98))) then
tmp = y * (0.5d0 / t)
else
tmp = z * ((-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 <= -6.3e-19) {
tmp = 0.5 * (x / t);
} else if ((x <= -3.7e-88) || (!(x <= -1.85e-292) && ((x <= 2.2e-144) || !(x <= 7.5e-98)))) {
tmp = y * (0.5 / t);
} else {
tmp = z * (-0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.3e-19: tmp = 0.5 * (x / t) elif (x <= -3.7e-88) or (not (x <= -1.85e-292) and ((x <= 2.2e-144) or not (x <= 7.5e-98))): tmp = y * (0.5 / t) else: tmp = z * (-0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.3e-19) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -3.7e-88) || (!(x <= -1.85e-292) && ((x <= 2.2e-144) || !(x <= 7.5e-98)))) tmp = Float64(y * Float64(0.5 / t)); else tmp = Float64(z * Float64(-0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.3e-19) tmp = 0.5 * (x / t); elseif ((x <= -3.7e-88) || (~((x <= -1.85e-292)) && ((x <= 2.2e-144) || ~((x <= 7.5e-98))))) tmp = y * (0.5 / t); else tmp = z * (-0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.3e-19], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -3.7e-88], And[N[Not[LessEqual[x, -1.85e-292]], $MachinePrecision], Or[LessEqual[x, 2.2e-144], N[Not[LessEqual[x, 7.5e-98]], $MachinePrecision]]]], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(z * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.3 \cdot 10^{-19}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-88} \lor \neg \left(x \leq -1.85 \cdot 10^{-292}\right) \land \left(x \leq 2.2 \cdot 10^{-144} \lor \neg \left(x \leq 7.5 \cdot 10^{-98}\right)\right):\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-0.5}{t}\\
\end{array}
\end{array}
if x < -6.30000000000000018e-19Initial program 100.0%
Taylor expanded in x around inf 65.0%
if -6.30000000000000018e-19 < x < -3.6999999999999997e-88 or -1.84999999999999998e-292 < x < 2.20000000000000006e-144 or 7.5000000000000006e-98 < x Initial program 100.0%
Taylor expanded in x around 0 99.2%
div-sub97.0%
distribute-lft-out97.0%
div-sub99.2%
Simplified99.2%
Taylor expanded in y around inf 45.3%
associate-*r/45.3%
associate-*l/45.2%
*-commutative45.2%
Simplified45.2%
if -3.6999999999999997e-88 < x < -1.84999999999999998e-292 or 2.20000000000000006e-144 < x < 7.5000000000000006e-98Initial program 100.0%
Taylor expanded in z around inf 57.3%
associate-*r/57.3%
associate-/l*56.5%
Simplified56.5%
associate-/r/57.1%
Applied egg-rr57.1%
Final simplification52.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.9e-20)
(* 0.5 (/ x t))
(if (or (<= x -3.7e-88)
(and (not (<= x -2.1e-287))
(or (<= x 1.8e-147) (not (<= x 7e-101)))))
(* y (/ 0.5 t))
(* -0.5 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e-20) {
tmp = 0.5 * (x / t);
} else if ((x <= -3.7e-88) || (!(x <= -2.1e-287) && ((x <= 1.8e-147) || !(x <= 7e-101)))) {
tmp = y * (0.5 / 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.9d-20)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-3.7d-88)) .or. (.not. (x <= (-2.1d-287))) .and. (x <= 1.8d-147) .or. (.not. (x <= 7d-101))) then
tmp = y * (0.5d0 / 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.9e-20) {
tmp = 0.5 * (x / t);
} else if ((x <= -3.7e-88) || (!(x <= -2.1e-287) && ((x <= 1.8e-147) || !(x <= 7e-101)))) {
tmp = y * (0.5 / t);
} else {
tmp = -0.5 * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.9e-20: tmp = 0.5 * (x / t) elif (x <= -3.7e-88) or (not (x <= -2.1e-287) and ((x <= 1.8e-147) or not (x <= 7e-101))): tmp = y * (0.5 / t) else: tmp = -0.5 * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.9e-20) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -3.7e-88) || (!(x <= -2.1e-287) && ((x <= 1.8e-147) || !(x <= 7e-101)))) tmp = Float64(y * Float64(0.5 / 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.9e-20) tmp = 0.5 * (x / t); elseif ((x <= -3.7e-88) || (~((x <= -2.1e-287)) && ((x <= 1.8e-147) || ~((x <= 7e-101))))) tmp = y * (0.5 / t); else tmp = -0.5 * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.9e-20], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -3.7e-88], And[N[Not[LessEqual[x, -2.1e-287]], $MachinePrecision], Or[LessEqual[x, 1.8e-147], N[Not[LessEqual[x, 7e-101]], $MachinePrecision]]]], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-20}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-88} \lor \neg \left(x \leq -2.1 \cdot 10^{-287}\right) \land \left(x \leq 1.8 \cdot 10^{-147} \lor \neg \left(x \leq 7 \cdot 10^{-101}\right)\right):\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.9e-20Initial program 100.0%
Taylor expanded in x around inf 65.0%
if -2.9e-20 < x < -3.6999999999999997e-88 or -2.0999999999999999e-287 < x < 1.80000000000000006e-147 or 6.99999999999999989e-101 < x Initial program 100.0%
Taylor expanded in x around 0 99.2%
div-sub97.0%
distribute-lft-out97.0%
div-sub99.2%
Simplified99.2%
Taylor expanded in y around inf 45.0%
associate-*r/45.0%
associate-*l/44.8%
*-commutative44.8%
Simplified44.8%
if -3.6999999999999997e-88 < x < -2.0999999999999999e-287 or 1.80000000000000006e-147 < x < 6.99999999999999989e-101Initial program 100.0%
Taylor expanded in z around inf 56.5%
*-commutative56.5%
Simplified56.5%
Final simplification52.6%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.4e-19)
(* 0.5 (/ x t))
(if (or (<= x -1.55e-87)
(and (not (<= x -1.06e-281))
(or (<= x 1e-143) (not (<= x 2.3e-104)))))
(/ (* y 0.5) t)
(* -0.5 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.4e-19) {
tmp = 0.5 * (x / t);
} else if ((x <= -1.55e-87) || (!(x <= -1.06e-281) && ((x <= 1e-143) || !(x <= 2.3e-104)))) {
tmp = (y * 0.5) / 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 <= (-1.4d-19)) then
tmp = 0.5d0 * (x / t)
else if ((x <= (-1.55d-87)) .or. (.not. (x <= (-1.06d-281))) .and. (x <= 1d-143) .or. (.not. (x <= 2.3d-104))) then
tmp = (y * 0.5d0) / 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 <= -1.4e-19) {
tmp = 0.5 * (x / t);
} else if ((x <= -1.55e-87) || (!(x <= -1.06e-281) && ((x <= 1e-143) || !(x <= 2.3e-104)))) {
tmp = (y * 0.5) / t;
} else {
tmp = -0.5 * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.4e-19: tmp = 0.5 * (x / t) elif (x <= -1.55e-87) or (not (x <= -1.06e-281) and ((x <= 1e-143) or not (x <= 2.3e-104))): tmp = (y * 0.5) / t else: tmp = -0.5 * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.4e-19) tmp = Float64(0.5 * Float64(x / t)); elseif ((x <= -1.55e-87) || (!(x <= -1.06e-281) && ((x <= 1e-143) || !(x <= 2.3e-104)))) tmp = Float64(Float64(y * 0.5) / 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 <= -1.4e-19) tmp = 0.5 * (x / t); elseif ((x <= -1.55e-87) || (~((x <= -1.06e-281)) && ((x <= 1e-143) || ~((x <= 2.3e-104))))) tmp = (y * 0.5) / t; else tmp = -0.5 * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.4e-19], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.55e-87], And[N[Not[LessEqual[x, -1.06e-281]], $MachinePrecision], Or[LessEqual[x, 1e-143], N[Not[LessEqual[x, 2.3e-104]], $MachinePrecision]]]], N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision], N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-19}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-87} \lor \neg \left(x \leq -1.06 \cdot 10^{-281}\right) \land \left(x \leq 10^{-143} \lor \neg \left(x \leq 2.3 \cdot 10^{-104}\right)\right):\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.40000000000000001e-19Initial program 100.0%
Taylor expanded in x around inf 65.0%
if -1.40000000000000001e-19 < x < -1.54999999999999999e-87 or -1.06e-281 < x < 9.9999999999999995e-144 or 2.2999999999999999e-104 < x Initial program 100.0%
Taylor expanded in y around inf 45.8%
associate-*r/45.8%
Simplified45.8%
if -1.54999999999999999e-87 < x < -1.06e-281 or 9.9999999999999995e-144 < x < 2.2999999999999999e-104Initial program 100.0%
Taylor expanded in z around inf 58.5%
*-commutative58.5%
Simplified58.5%
Final simplification53.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* y 0.5) t)))
(if (<= x -1.02e-21)
(* 0.5 (/ x t))
(if (<= x -9.6e-88)
t_1
(if (<= x -4.4e-289)
(/ (* z -0.5) t)
(if (or (<= x 1.4e-141) (not (<= x 1.75e-99)))
t_1
(* -0.5 (/ z t))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 0.5) / t;
double tmp;
if (x <= -1.02e-21) {
tmp = 0.5 * (x / t);
} else if (x <= -9.6e-88) {
tmp = t_1;
} else if (x <= -4.4e-289) {
tmp = (z * -0.5) / t;
} else if ((x <= 1.4e-141) || !(x <= 1.75e-99)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y * 0.5d0) / t
if (x <= (-1.02d-21)) then
tmp = 0.5d0 * (x / t)
else if (x <= (-9.6d-88)) then
tmp = t_1
else if (x <= (-4.4d-289)) then
tmp = (z * (-0.5d0)) / t
else if ((x <= 1.4d-141) .or. (.not. (x <= 1.75d-99))) then
tmp = t_1
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 t_1 = (y * 0.5) / t;
double tmp;
if (x <= -1.02e-21) {
tmp = 0.5 * (x / t);
} else if (x <= -9.6e-88) {
tmp = t_1;
} else if (x <= -4.4e-289) {
tmp = (z * -0.5) / t;
} else if ((x <= 1.4e-141) || !(x <= 1.75e-99)) {
tmp = t_1;
} else {
tmp = -0.5 * (z / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 0.5) / t tmp = 0 if x <= -1.02e-21: tmp = 0.5 * (x / t) elif x <= -9.6e-88: tmp = t_1 elif x <= -4.4e-289: tmp = (z * -0.5) / t elif (x <= 1.4e-141) or not (x <= 1.75e-99): tmp = t_1 else: tmp = -0.5 * (z / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 0.5) / t) tmp = 0.0 if (x <= -1.02e-21) tmp = Float64(0.5 * Float64(x / t)); elseif (x <= -9.6e-88) tmp = t_1; elseif (x <= -4.4e-289) tmp = Float64(Float64(z * -0.5) / t); elseif ((x <= 1.4e-141) || !(x <= 1.75e-99)) tmp = t_1; else tmp = Float64(-0.5 * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 0.5) / t; tmp = 0.0; if (x <= -1.02e-21) tmp = 0.5 * (x / t); elseif (x <= -9.6e-88) tmp = t_1; elseif (x <= -4.4e-289) tmp = (z * -0.5) / t; elseif ((x <= 1.4e-141) || ~((x <= 1.75e-99))) tmp = t_1; else tmp = -0.5 * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[x, -1.02e-21], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -9.6e-88], t$95$1, If[LessEqual[x, -4.4e-289], N[(N[(z * -0.5), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[x, 1.4e-141], N[Not[LessEqual[x, 1.75e-99]], $MachinePrecision]], t$95$1, N[(-0.5 * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot 0.5}{t}\\
\mathbf{if}\;x \leq -1.02 \cdot 10^{-21}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq -9.6 \cdot 10^{-88}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-289}:\\
\;\;\;\;\frac{z \cdot -0.5}{t}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-141} \lor \neg \left(x \leq 1.75 \cdot 10^{-99}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -1.02000000000000004e-21Initial program 100.0%
Taylor expanded in x around inf 65.0%
if -1.02000000000000004e-21 < x < -9.5999999999999998e-88 or -4.4e-289 < x < 1.40000000000000006e-141 or 1.7499999999999999e-99 < x Initial program 100.0%
Taylor expanded in y around inf 45.0%
associate-*r/45.0%
Simplified45.0%
if -9.5999999999999998e-88 < x < -4.4e-289Initial program 100.0%
Taylor expanded in z around inf 54.0%
*-commutative54.0%
Simplified54.0%
associate-*l/54.1%
Applied egg-rr54.1%
if 1.40000000000000006e-141 < x < 1.7499999999999999e-99Initial program 100.0%
Taylor expanded in z around inf 80.4%
*-commutative80.4%
Simplified80.4%
Final simplification52.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 0.5 (/ (- x z) t))))
(if (<= y 1.62e+86)
t_1
(if (<= y 1.25e+121)
(* y (/ 0.5 t))
(if (<= y 7e+145) t_1 (/ (* y 0.5) t))))))
double code(double x, double y, double z, double t) {
double t_1 = 0.5 * ((x - z) / t);
double tmp;
if (y <= 1.62e+86) {
tmp = t_1;
} else if (y <= 1.25e+121) {
tmp = y * (0.5 / t);
} else if (y <= 7e+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) :: tmp
t_1 = 0.5d0 * ((x - z) / t)
if (y <= 1.62d+86) then
tmp = t_1
else if (y <= 1.25d+121) then
tmp = y * (0.5d0 / t)
else if (y <= 7d+145) 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 = 0.5 * ((x - z) / t);
double tmp;
if (y <= 1.62e+86) {
tmp = t_1;
} else if (y <= 1.25e+121) {
tmp = y * (0.5 / t);
} else if (y <= 7e+145) {
tmp = t_1;
} else {
tmp = (y * 0.5) / t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 0.5 * ((x - z) / t) tmp = 0 if y <= 1.62e+86: tmp = t_1 elif y <= 1.25e+121: tmp = y * (0.5 / t) elif y <= 7e+145: tmp = t_1 else: tmp = (y * 0.5) / t return tmp
function code(x, y, z, t) t_1 = Float64(0.5 * Float64(Float64(x - z) / t)) tmp = 0.0 if (y <= 1.62e+86) tmp = t_1; elseif (y <= 1.25e+121) tmp = Float64(y * Float64(0.5 / t)); elseif (y <= 7e+145) tmp = t_1; else tmp = Float64(Float64(y * 0.5) / t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 0.5 * ((x - z) / t); tmp = 0.0; if (y <= 1.62e+86) tmp = t_1; elseif (y <= 1.25e+121) tmp = y * (0.5 / t); elseif (y <= 7e+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[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.62e+86], t$95$1, If[LessEqual[y, 1.25e+121], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+145], t$95$1, N[(N[(y * 0.5), $MachinePrecision] / t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x - z}{t}\\
\mathbf{if}\;y \leq 1.62 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+121}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+145}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 0.5}{t}\\
\end{array}
\end{array}
if y < 1.6200000000000001e86 or 1.25000000000000002e121 < y < 7.0000000000000002e145Initial program 100.0%
Taylor expanded in y around 0 74.0%
if 1.6200000000000001e86 < y < 1.25000000000000002e121Initial program 100.0%
Taylor expanded in x around 0 83.3%
div-sub83.3%
distribute-lft-out83.3%
div-sub83.3%
Simplified83.3%
Taylor expanded in y around inf 83.7%
associate-*r/83.7%
associate-*l/83.7%
*-commutative83.7%
Simplified83.7%
if 7.0000000000000002e145 < y Initial program 100.0%
Taylor expanded in y around inf 78.8%
associate-*r/78.8%
Simplified78.8%
Final simplification74.9%
(FPCore (x y z t) :precision binary64 (if (<= y 1e+84) (* 0.5 (/ (- x z) t)) (* (+ x y) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 1e+84) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (x + 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 <= 1d+84) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = (x + 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 <= 1e+84) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (x + y) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 1e+84: tmp = 0.5 * ((x - z) / t) else: tmp = (x + y) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 1e+84) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(Float64(x + y) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 1e+84) tmp = 0.5 * ((x - z) / t); else tmp = (x + y) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 1e+84], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+84}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if y < 1.00000000000000006e84Initial program 100.0%
Taylor expanded in y around 0 73.7%
if 1.00000000000000006e84 < y Initial program 100.0%
Taylor expanded in z around 0 86.0%
associate-*r/86.0%
associate-*l/85.8%
*-commutative85.8%
+-commutative85.8%
Simplified85.8%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2e-27) (* 0.5 (/ (- x z) t)) (* (- y z) (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2e-27) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (y - z) * (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 <= (-2d-27)) then
tmp = 0.5d0 * ((x - z) / t)
else
tmp = (y - z) * (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 <= -2e-27) {
tmp = 0.5 * ((x - z) / t);
} else {
tmp = (y - z) * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2e-27: tmp = 0.5 * ((x - z) / t) else: tmp = (y - z) * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2e-27) tmp = Float64(0.5 * Float64(Float64(x - z) / t)); else tmp = Float64(Float64(y - z) * Float64(0.5 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2e-27) tmp = 0.5 * ((x - z) / t); else tmp = (y - z) * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2e-27], N[(0.5 * N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-27}:\\
\;\;\;\;0.5 \cdot \frac{x - z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -2.0000000000000001e-27Initial program 100.0%
Taylor expanded in y around 0 81.9%
if -2.0000000000000001e-27 < x Initial program 100.0%
Taylor expanded in x around 0 78.9%
associate-*r/78.9%
*-commutative78.9%
associate-*r/78.7%
Simplified78.7%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.45e-19) (* 0.5 (/ x t)) (* y (/ 0.5 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.45e-19) {
tmp = 0.5 * (x / 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 (x <= (-2.45d-19)) then
tmp = 0.5d0 * (x / 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 (x <= -2.45e-19) {
tmp = 0.5 * (x / t);
} else {
tmp = y * (0.5 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.45e-19: tmp = 0.5 * (x / t) else: tmp = y * (0.5 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.45e-19) tmp = Float64(0.5 * Float64(x / 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 (x <= -2.45e-19) tmp = 0.5 * (x / t); else tmp = y * (0.5 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.45e-19], N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(0.5 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{-19}:\\
\;\;\;\;0.5 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{0.5}{t}\\
\end{array}
\end{array}
if x < -2.44999999999999996e-19Initial program 100.0%
Taylor expanded in x around inf 65.0%
if -2.44999999999999996e-19 < x Initial program 100.0%
Taylor expanded in x around 0 99.4%
div-sub97.9%
distribute-lft-out97.9%
div-sub99.4%
Simplified99.4%
Taylor expanded in y around inf 46.1%
associate-*r/46.1%
associate-*l/45.9%
*-commutative45.9%
Simplified45.9%
Final simplification50.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%
Taylor expanded in x around inf 37.8%
Final simplification37.8%
herbie shell --seed 2023336
(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)))