
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - 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 = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - 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 = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 -5e+285) (not (<= t_1 2e+307)))
(+ x (* y (/ (- z x) t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -5e+285) || !(t_1 <= 2e+307)) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = t_1;
}
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 = x + ((y * (z - x)) / t)
if ((t_1 <= (-5d+285)) .or. (.not. (t_1 <= 2d+307))) then
tmp = x + (y * ((z - x) / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -5e+285) || !(t_1 <= 2e+307)) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y * (z - x)) / t) tmp = 0 if (t_1 <= -5e+285) or not (t_1 <= 2e+307): tmp = x + (y * ((z - x) / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if ((t_1 <= -5e+285) || !(t_1 <= 2e+307)) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y * (z - x)) / t); tmp = 0.0; if ((t_1 <= -5e+285) || ~((t_1 <= 2e+307))) tmp = x + (y * ((z - x) / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+285], N[Not[LessEqual[t$95$1, 2e+307]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+285} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+307}\right):\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -5.00000000000000016e285 or 1.99999999999999997e307 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 83.2%
+-commutative83.2%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
Applied egg-rr99.9%
if -5.00000000000000016e285 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1.99999999999999997e307Initial program 99.2%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ (- z x) t))) (t_2 (* x (- 1.0 (/ y t)))))
(if (<= x -2.6e-52)
t_2
(if (<= x -1.6e-199)
t_1
(if (<= x 6.5e-198) (/ (* y z) t) (if (<= x 0.000235) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double t_2 = x * (1.0 - (y / t));
double tmp;
if (x <= -2.6e-52) {
tmp = t_2;
} else if (x <= -1.6e-199) {
tmp = t_1;
} else if (x <= 6.5e-198) {
tmp = (y * z) / t;
} else if (x <= 0.000235) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = y * ((z - x) / t)
t_2 = x * (1.0d0 - (y / t))
if (x <= (-2.6d-52)) then
tmp = t_2
else if (x <= (-1.6d-199)) then
tmp = t_1
else if (x <= 6.5d-198) then
tmp = (y * z) / t
else if (x <= 0.000235d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double t_2 = x * (1.0 - (y / t));
double tmp;
if (x <= -2.6e-52) {
tmp = t_2;
} else if (x <= -1.6e-199) {
tmp = t_1;
} else if (x <= 6.5e-198) {
tmp = (y * z) / t;
} else if (x <= 0.000235) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) t_2 = x * (1.0 - (y / t)) tmp = 0 if x <= -2.6e-52: tmp = t_2 elif x <= -1.6e-199: tmp = t_1 elif x <= 6.5e-198: tmp = (y * z) / t elif x <= 0.000235: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) t_2 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -2.6e-52) tmp = t_2; elseif (x <= -1.6e-199) tmp = t_1; elseif (x <= 6.5e-198) tmp = Float64(Float64(y * z) / t); elseif (x <= 0.000235) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); t_2 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -2.6e-52) tmp = t_2; elseif (x <= -1.6e-199) tmp = t_1; elseif (x <= 6.5e-198) tmp = (y * z) / t; elseif (x <= 0.000235) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6e-52], t$95$2, If[LessEqual[x, -1.6e-199], t$95$1, If[LessEqual[x, 6.5e-198], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, 0.000235], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
t_2 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{-52}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.6 \cdot 10^{-199}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-198}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{elif}\;x \leq 0.000235:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -2.5999999999999999e-52 or 2.34999999999999993e-4 < x Initial program 90.1%
Taylor expanded in x around inf 90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
if -2.5999999999999999e-52 < x < -1.6e-199 or 6.5000000000000004e-198 < x < 2.34999999999999993e-4Initial program 98.2%
Taylor expanded in y around -inf 75.3%
associate-/l*75.5%
*-commutative75.5%
Applied egg-rr75.5%
if -1.6e-199 < x < 6.5000000000000004e-198Initial program 99.8%
Taylor expanded in y around -inf 90.6%
Taylor expanded in z around inf 87.1%
Final simplification86.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.95e+102)
x
(if (or (<= t -6.8e+30) (and (not (<= t -125.0)) (<= t 3.7e+22)))
(* z (/ y t))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.95e+102) {
tmp = x;
} else if ((t <= -6.8e+30) || (!(t <= -125.0) && (t <= 3.7e+22))) {
tmp = z * (y / t);
} else {
tmp = x;
}
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 (t <= (-1.95d+102)) then
tmp = x
else if ((t <= (-6.8d+30)) .or. (.not. (t <= (-125.0d0))) .and. (t <= 3.7d+22)) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.95e+102) {
tmp = x;
} else if ((t <= -6.8e+30) || (!(t <= -125.0) && (t <= 3.7e+22))) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.95e+102: tmp = x elif (t <= -6.8e+30) or (not (t <= -125.0) and (t <= 3.7e+22)): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.95e+102) tmp = x; elseif ((t <= -6.8e+30) || (!(t <= -125.0) && (t <= 3.7e+22))) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.95e+102) tmp = x; elseif ((t <= -6.8e+30) || (~((t <= -125.0)) && (t <= 3.7e+22))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.95e+102], x, If[Or[LessEqual[t, -6.8e+30], And[N[Not[LessEqual[t, -125.0]], $MachinePrecision], LessEqual[t, 3.7e+22]]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{+102}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -6.8 \cdot 10^{+30} \lor \neg \left(t \leq -125\right) \land t \leq 3.7 \cdot 10^{+22}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.9499999999999999e102 or -6.8000000000000005e30 < t < -125 or 3.6999999999999998e22 < t Initial program 86.3%
Taylor expanded in y around 0 67.0%
if -1.9499999999999999e102 < t < -6.8000000000000005e30 or -125 < t < 3.6999999999999998e22Initial program 99.2%
Taylor expanded in y around -inf 87.5%
Taylor expanded in z around inf 52.4%
*-commutative63.7%
associate-*r/66.9%
Simplified55.7%
Final simplification60.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.9e+102)
x
(if (or (<= t -3.4e+29) (and (not (<= t -2.25e-65)) (<= t 3.5e+17)))
(* y (/ z t))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e+102) {
tmp = x;
} else if ((t <= -3.4e+29) || (!(t <= -2.25e-65) && (t <= 3.5e+17))) {
tmp = y * (z / t);
} else {
tmp = x;
}
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 (t <= (-1.9d+102)) then
tmp = x
else if ((t <= (-3.4d+29)) .or. (.not. (t <= (-2.25d-65))) .and. (t <= 3.5d+17)) then
tmp = y * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e+102) {
tmp = x;
} else if ((t <= -3.4e+29) || (!(t <= -2.25e-65) && (t <= 3.5e+17))) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.9e+102: tmp = x elif (t <= -3.4e+29) or (not (t <= -2.25e-65) and (t <= 3.5e+17)): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.9e+102) tmp = x; elseif ((t <= -3.4e+29) || (!(t <= -2.25e-65) && (t <= 3.5e+17))) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.9e+102) tmp = x; elseif ((t <= -3.4e+29) || (~((t <= -2.25e-65)) && (t <= 3.5e+17))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.9e+102], x, If[Or[LessEqual[t, -3.4e+29], And[N[Not[LessEqual[t, -2.25e-65]], $MachinePrecision], LessEqual[t, 3.5e+17]]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+102}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{+29} \lor \neg \left(t \leq -2.25 \cdot 10^{-65}\right) \land t \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.89999999999999989e102 or -3.39999999999999981e29 < t < -2.2499999999999999e-65 or 3.5e17 < t Initial program 87.9%
Taylor expanded in y around 0 62.6%
if -1.89999999999999989e102 < t < -3.39999999999999981e29 or -2.2499999999999999e-65 < t < 3.5e17Initial program 99.1%
Taylor expanded in y around -inf 89.5%
Taylor expanded in z around inf 55.6%
associate-/l*58.8%
Simplified50.6%
Final simplification56.5%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.9e+102)
x
(if (<= t -2.6e+30)
(/ z (/ t y))
(if (<= t -110.0) x (if (<= t 3.5e+18) (* z (/ y t)) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e+102) {
tmp = x;
} else if (t <= -2.6e+30) {
tmp = z / (t / y);
} else if (t <= -110.0) {
tmp = x;
} else if (t <= 3.5e+18) {
tmp = z * (y / t);
} else {
tmp = x;
}
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 (t <= (-1.9d+102)) then
tmp = x
else if (t <= (-2.6d+30)) then
tmp = z / (t / y)
else if (t <= (-110.0d0)) then
tmp = x
else if (t <= 3.5d+18) then
tmp = z * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e+102) {
tmp = x;
} else if (t <= -2.6e+30) {
tmp = z / (t / y);
} else if (t <= -110.0) {
tmp = x;
} else if (t <= 3.5e+18) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.9e+102: tmp = x elif t <= -2.6e+30: tmp = z / (t / y) elif t <= -110.0: tmp = x elif t <= 3.5e+18: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.9e+102) tmp = x; elseif (t <= -2.6e+30) tmp = Float64(z / Float64(t / y)); elseif (t <= -110.0) tmp = x; elseif (t <= 3.5e+18) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.9e+102) tmp = x; elseif (t <= -2.6e+30) tmp = z / (t / y); elseif (t <= -110.0) tmp = x; elseif (t <= 3.5e+18) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.9e+102], x, If[LessEqual[t, -2.6e+30], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -110.0], x, If[LessEqual[t, 3.5e+18], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+102}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{+30}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq -110:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+18}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.89999999999999989e102 or -2.59999999999999988e30 < t < -110 or 3.5e18 < t Initial program 86.3%
Taylor expanded in y around 0 67.0%
if -1.89999999999999989e102 < t < -2.59999999999999988e30Initial program 99.9%
Taylor expanded in y around -inf 86.7%
Taylor expanded in z around inf 65.1%
*-commutative78.1%
associate-*r/78.1%
Simplified65.1%
clear-num65.2%
un-div-inv65.2%
Applied egg-rr65.2%
if -110 < t < 3.5e18Initial program 99.1%
Taylor expanded in y around -inf 87.5%
Taylor expanded in z around inf 51.0%
*-commutative62.0%
associate-*r/65.6%
Simplified54.6%
(FPCore (x y z t) :precision binary64 (if (<= y -4700.0) (* z (/ y t)) (if (<= y 8.2e-122) x (if (<= y 9e+19) (/ (* y z) t) (* x (/ y (- t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4700.0) {
tmp = z * (y / t);
} else if (y <= 8.2e-122) {
tmp = x;
} else if (y <= 9e+19) {
tmp = (y * z) / t;
} else {
tmp = 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 <= (-4700.0d0)) then
tmp = z * (y / t)
else if (y <= 8.2d-122) then
tmp = x
else if (y <= 9d+19) then
tmp = (y * z) / t
else
tmp = 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 <= -4700.0) {
tmp = z * (y / t);
} else if (y <= 8.2e-122) {
tmp = x;
} else if (y <= 9e+19) {
tmp = (y * z) / t;
} else {
tmp = x * (y / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4700.0: tmp = z * (y / t) elif y <= 8.2e-122: tmp = x elif y <= 9e+19: tmp = (y * z) / t else: tmp = x * (y / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4700.0) tmp = Float64(z * Float64(y / t)); elseif (y <= 8.2e-122) tmp = x; elseif (y <= 9e+19) tmp = Float64(Float64(y * z) / t); else tmp = Float64(x * Float64(y / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4700.0) tmp = z * (y / t); elseif (y <= 8.2e-122) tmp = x; elseif (y <= 9e+19) tmp = (y * z) / t; else tmp = x * (y / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4700.0], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e-122], x, If[LessEqual[y, 9e+19], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4700:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+19}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\end{array}
\end{array}
if y < -4700Initial program 90.2%
Taylor expanded in y around -inf 86.4%
Taylor expanded in z around inf 48.9%
*-commutative56.7%
associate-*r/65.1%
Simplified55.5%
if -4700 < y < 8.2000000000000001e-122Initial program 99.0%
Taylor expanded in y around 0 65.8%
if 8.2000000000000001e-122 < y < 9e19Initial program 99.9%
Taylor expanded in y around -inf 71.7%
Taylor expanded in z around inf 59.7%
if 9e19 < y Initial program 85.0%
Taylor expanded in y around -inf 76.7%
Taylor expanded in z around 0 54.2%
mul-1-neg54.2%
associate-/l*66.1%
distribute-rgt-neg-in66.1%
distribute-neg-frac266.1%
Simplified66.1%
(FPCore (x y z t) :precision binary64 (if (<= y -105.0) (/ (* y (- z x)) t) (if (<= y 4.2e-37) (+ x (/ 1.0 (/ t (* y z)))) (* y (/ (- z x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -105.0) {
tmp = (y * (z - x)) / t;
} else if (y <= 4.2e-37) {
tmp = x + (1.0 / (t / (y * z)));
} else {
tmp = y * ((z - x) / 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 <= (-105.0d0)) then
tmp = (y * (z - x)) / t
else if (y <= 4.2d-37) then
tmp = x + (1.0d0 / (t / (y * z)))
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -105.0) {
tmp = (y * (z - x)) / t;
} else if (y <= 4.2e-37) {
tmp = x + (1.0 / (t / (y * z)));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -105.0: tmp = (y * (z - x)) / t elif y <= 4.2e-37: tmp = x + (1.0 / (t / (y * z))) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -105.0) tmp = Float64(Float64(y * Float64(z - x)) / t); elseif (y <= 4.2e-37) tmp = Float64(x + Float64(1.0 / Float64(t / Float64(y * z)))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -105.0) tmp = (y * (z - x)) / t; elseif (y <= 4.2e-37) tmp = x + (1.0 / (t / (y * z))); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -105.0], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 4.2e-37], N[(x + N[(1.0 / N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -105:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-37}:\\
\;\;\;\;x + \frac{1}{\frac{t}{y \cdot z}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if y < -105Initial program 90.2%
Taylor expanded in y around -inf 86.4%
if -105 < y < 4.2000000000000002e-37Initial program 99.1%
Taylor expanded in z around inf 89.3%
associate-/l*83.3%
Simplified83.3%
associate-*r/89.3%
clear-num89.3%
Applied egg-rr89.3%
if 4.2000000000000002e-37 < y Initial program 86.5%
Taylor expanded in y around -inf 77.6%
associate-/l*86.9%
*-commutative86.9%
Applied egg-rr86.9%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.2e+15) (not (<= y 6.9e-37))) (* y (/ (- z x) t)) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e+15) || !(y <= 6.9e-37)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + (z * (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+15)) .or. (.not. (y <= 6.9d-37))) then
tmp = y * ((z - x) / t)
else
tmp = x + (z * (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+15) || !(y <= 6.9e-37)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e+15) or not (y <= 6.9e-37): tmp = y * ((z - x) / t) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e+15) || !(y <= 6.9e-37)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.2e+15) || ~((y <= 6.9e-37))) tmp = y * ((z - x) / t); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e+15], N[Not[LessEqual[y, 6.9e-37]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+15} \lor \neg \left(y \leq 6.9 \cdot 10^{-37}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -7.2e15 or 6.8999999999999999e-37 < y Initial program 88.1%
Taylor expanded in y around -inf 81.6%
associate-/l*86.0%
*-commutative86.0%
Applied egg-rr86.0%
if -7.2e15 < y < 6.8999999999999999e-37Initial program 99.1%
Taylor expanded in z around inf 89.3%
*-commutative89.3%
associate-*r/88.8%
Simplified88.8%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.3e+18) (not (<= y 2.7e-40))) (* y (/ (- z x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.3e+18) || !(y <= 2.7e-40)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + (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 <= (-8.3d+18)) .or. (.not. (y <= 2.7d-40))) then
tmp = y * ((z - x) / t)
else
tmp = x + (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 <= -8.3e+18) || !(y <= 2.7e-40)) {
tmp = y * ((z - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.3e+18) or not (y <= 2.7e-40): tmp = y * ((z - x) / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.3e+18) || !(y <= 2.7e-40)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -8.3e+18) || ~((y <= 2.7e-40))) tmp = y * ((z - x) / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.3e+18], N[Not[LessEqual[y, 2.7e-40]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.3 \cdot 10^{+18} \lor \neg \left(y \leq 2.7 \cdot 10^{-40}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -8.3e18 or 2.7e-40 < y Initial program 88.2%
Taylor expanded in y around -inf 81.7%
associate-/l*86.1%
*-commutative86.1%
Applied egg-rr86.1%
if -8.3e18 < y < 2.7e-40Initial program 99.1%
Taylor expanded in z around inf 89.2%
associate-/l*83.2%
Simplified83.2%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.55e-146) (not (<= x 1.4e-71))) (* x (- 1.0 (/ y t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.55e-146) || !(x <= 1.4e-71)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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 <= (-1.55d-146)) .or. (.not. (x <= 1.4d-71))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (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 <= -1.55e-146) || !(x <= 1.4e-71)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.55e-146) or not (x <= 1.4e-71): tmp = x * (1.0 - (y / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.55e-146) || !(x <= 1.4e-71)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.55e-146) || ~((x <= 1.4e-71))) tmp = x * (1.0 - (y / t)); else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.55e-146], N[Not[LessEqual[x, 1.4e-71]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-146} \lor \neg \left(x \leq 1.4 \cdot 10^{-71}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -1.5499999999999999e-146 or 1.4e-71 < x Initial program 91.8%
Taylor expanded in x around inf 85.5%
mul-1-neg85.5%
unsub-neg85.5%
Simplified85.5%
if -1.5499999999999999e-146 < x < 1.4e-71Initial program 98.4%
Taylor expanded in y around -inf 81.9%
Taylor expanded in z around inf 72.6%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (<= y -180000.0) (/ (* y (- z x)) t) (if (<= y 6.9e-37) (+ x (* z (/ y t))) (* y (/ (- z x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -180000.0) {
tmp = (y * (z - x)) / t;
} else if (y <= 6.9e-37) {
tmp = x + (z * (y / t));
} else {
tmp = y * ((z - x) / 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 <= (-180000.0d0)) then
tmp = (y * (z - x)) / t
else if (y <= 6.9d-37) then
tmp = x + (z * (y / t))
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -180000.0) {
tmp = (y * (z - x)) / t;
} else if (y <= 6.9e-37) {
tmp = x + (z * (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -180000.0: tmp = (y * (z - x)) / t elif y <= 6.9e-37: tmp = x + (z * (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -180000.0) tmp = Float64(Float64(y * Float64(z - x)) / t); elseif (y <= 6.9e-37) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -180000.0) tmp = (y * (z - x)) / t; elseif (y <= 6.9e-37) tmp = x + (z * (y / t)); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -180000.0], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 6.9e-37], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -180000:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{elif}\;y \leq 6.9 \cdot 10^{-37}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if y < -1.8e5Initial program 90.2%
Taylor expanded in y around -inf 86.4%
if -1.8e5 < y < 6.8999999999999999e-37Initial program 99.1%
Taylor expanded in z around inf 89.3%
*-commutative89.3%
associate-*r/88.8%
Simplified88.8%
if 6.8999999999999999e-37 < y Initial program 86.5%
Taylor expanded in y around -inf 77.6%
associate-/l*86.9%
*-commutative86.9%
Applied egg-rr86.9%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= x -4e+151) (* x (- 1.0 (/ y t))) (+ x (/ (* y (- z x)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4e+151) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y * (z - x)) / 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 <= (-4d+151)) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((y * (z - x)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4e+151) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y * (z - x)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4e+151: tmp = x * (1.0 - (y / t)) else: tmp = x + ((y * (z - x)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4e+151) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y * Float64(z - x)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4e+151) tmp = x * (1.0 - (y / t)); else tmp = x + ((y * (z - x)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4e+151], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+151}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\end{array}
\end{array}
if x < -4.00000000000000007e151Initial program 79.2%
Taylor expanded in x around inf 97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
if -4.00000000000000007e151 < x Initial program 96.0%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.6%
Taylor expanded in y around 0 36.8%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / 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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024086
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))