
(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 14 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 (/ (* (- z x) y) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+283)))
(+ x (/ y (/ t (- z x))))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+283)) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+283)) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) * y) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+283): tmp = x + (y / (t / (z - x))) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) * y) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+283)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) * y) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+283))) tmp = x + (y / (t / (z - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+283]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+283}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 1.99999999999999991e283 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 77.9%
associate-/l*99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1.99999999999999991e283Initial program 99.3%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -5.9e+26)
(/ z (/ t y))
(if (<= y -6.2e-7)
(* y (/ (- x) t))
(if (<= y 1.1e+68)
x
(if (<= y 4.2e+251) (* z (/ y t)) (* (/ y t) (- x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.9e+26) {
tmp = z / (t / y);
} else if (y <= -6.2e-7) {
tmp = y * (-x / t);
} else if (y <= 1.1e+68) {
tmp = x;
} else if (y <= 4.2e+251) {
tmp = z * (y / t);
} else {
tmp = (y / t) * -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 (y <= (-5.9d+26)) then
tmp = z / (t / y)
else if (y <= (-6.2d-7)) then
tmp = y * (-x / t)
else if (y <= 1.1d+68) then
tmp = x
else if (y <= 4.2d+251) then
tmp = z * (y / t)
else
tmp = (y / t) * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.9e+26) {
tmp = z / (t / y);
} else if (y <= -6.2e-7) {
tmp = y * (-x / t);
} else if (y <= 1.1e+68) {
tmp = x;
} else if (y <= 4.2e+251) {
tmp = z * (y / t);
} else {
tmp = (y / t) * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.9e+26: tmp = z / (t / y) elif y <= -6.2e-7: tmp = y * (-x / t) elif y <= 1.1e+68: tmp = x elif y <= 4.2e+251: tmp = z * (y / t) else: tmp = (y / t) * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.9e+26) tmp = Float64(z / Float64(t / y)); elseif (y <= -6.2e-7) tmp = Float64(y * Float64(Float64(-x) / t)); elseif (y <= 1.1e+68) tmp = x; elseif (y <= 4.2e+251) tmp = Float64(z * Float64(y / t)); else tmp = Float64(Float64(y / t) * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.9e+26) tmp = z / (t / y); elseif (y <= -6.2e-7) tmp = y * (-x / t); elseif (y <= 1.1e+68) tmp = x; elseif (y <= 4.2e+251) tmp = z * (y / t); else tmp = (y / t) * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.9e+26], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.2e-7], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+68], x, If[LessEqual[y, 4.2e+251], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+26}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+68}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+251}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -5.9000000000000003e26Initial program 89.2%
Taylor expanded in y around -inf 75.6%
*-commutative75.6%
associate-/l*83.0%
Applied egg-rr83.0%
Taylor expanded in z around inf 48.4%
*-commutative48.4%
associate-*r/58.4%
Simplified58.4%
clear-num58.4%
un-div-inv58.4%
Applied egg-rr58.4%
if -5.9000000000000003e26 < y < -6.1999999999999999e-7Initial program 99.7%
Taylor expanded in y around inf 100.0%
Taylor expanded in z around 0 89.6%
mul-1-neg89.6%
distribute-frac-neg289.6%
Simplified89.6%
if -6.1999999999999999e-7 < y < 1.09999999999999994e68Initial program 97.8%
Taylor expanded in y around 0 70.5%
if 1.09999999999999994e68 < y < 4.2000000000000001e251Initial program 87.1%
Taylor expanded in y around -inf 81.9%
*-commutative81.9%
associate-/l*94.6%
Applied egg-rr94.6%
Taylor expanded in z around inf 58.7%
*-commutative58.7%
associate-*r/71.5%
Simplified71.5%
if 4.2000000000000001e251 < y Initial program 74.8%
Taylor expanded in y around -inf 74.8%
Taylor expanded in z around 0 42.8%
mul-1-neg42.8%
associate-/l*73.4%
distribute-rgt-neg-in73.4%
mul-1-neg73.4%
associate-*r/73.4%
mul-1-neg73.4%
Simplified73.4%
Final simplification68.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y t) (- x))))
(if (<= y -1.22e+27)
(/ z (/ t y))
(if (<= y -6.2e-7)
t_1
(if (<= y 4.1e+67) x (if (<= y 5.4e+252) (* z (/ y t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / t) * -x;
double tmp;
if (y <= -1.22e+27) {
tmp = z / (t / y);
} else if (y <= -6.2e-7) {
tmp = t_1;
} else if (y <= 4.1e+67) {
tmp = x;
} else if (y <= 5.4e+252) {
tmp = z * (y / 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 = (y / t) * -x
if (y <= (-1.22d+27)) then
tmp = z / (t / y)
else if (y <= (-6.2d-7)) then
tmp = t_1
else if (y <= 4.1d+67) then
tmp = x
else if (y <= 5.4d+252) then
tmp = z * (y / 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 = (y / t) * -x;
double tmp;
if (y <= -1.22e+27) {
tmp = z / (t / y);
} else if (y <= -6.2e-7) {
tmp = t_1;
} else if (y <= 4.1e+67) {
tmp = x;
} else if (y <= 5.4e+252) {
tmp = z * (y / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * -x tmp = 0 if y <= -1.22e+27: tmp = z / (t / y) elif y <= -6.2e-7: tmp = t_1 elif y <= 4.1e+67: tmp = x elif y <= 5.4e+252: tmp = z * (y / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * Float64(-x)) tmp = 0.0 if (y <= -1.22e+27) tmp = Float64(z / Float64(t / y)); elseif (y <= -6.2e-7) tmp = t_1; elseif (y <= 4.1e+67) tmp = x; elseif (y <= 5.4e+252) tmp = Float64(z * Float64(y / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * -x; tmp = 0.0; if (y <= -1.22e+27) tmp = z / (t / y); elseif (y <= -6.2e-7) tmp = t_1; elseif (y <= 4.1e+67) tmp = x; elseif (y <= 5.4e+252) tmp = z * (y / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision]}, If[LessEqual[y, -1.22e+27], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6.2e-7], t$95$1, If[LessEqual[y, 4.1e+67], x, If[LessEqual[y, 5.4e+252], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{t} \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -1.22 \cdot 10^{+27}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+252}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.2200000000000001e27Initial program 89.2%
Taylor expanded in y around -inf 75.6%
*-commutative75.6%
associate-/l*83.0%
Applied egg-rr83.0%
Taylor expanded in z around inf 48.4%
*-commutative48.4%
associate-*r/58.4%
Simplified58.4%
clear-num58.4%
un-div-inv58.4%
Applied egg-rr58.4%
if -1.2200000000000001e27 < y < -6.1999999999999999e-7 or 5.40000000000000021e252 < y Initial program 82.0%
Taylor expanded in y around -inf 82.0%
Taylor expanded in z around 0 56.2%
mul-1-neg56.2%
associate-/l*77.9%
distribute-rgt-neg-in77.9%
mul-1-neg77.9%
associate-*r/77.9%
mul-1-neg77.9%
Simplified77.9%
if -6.1999999999999999e-7 < y < 4.09999999999999979e67Initial program 97.8%
Taylor expanded in y around 0 70.5%
if 4.09999999999999979e67 < y < 5.40000000000000021e252Initial program 87.1%
Taylor expanded in y around -inf 81.9%
*-commutative81.9%
associate-/l*94.6%
Applied egg-rr94.6%
Taylor expanded in z around inf 58.7%
*-commutative58.7%
associate-*r/71.5%
Simplified71.5%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.5e-7) (not (<= y 6e+72))) (* (- z x) (/ y t)) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.5e-7) || !(y <= 6e+72)) {
tmp = (z - x) * (y / 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 <= (-6.5d-7)) .or. (.not. (y <= 6d+72))) then
tmp = (z - x) * (y / 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 <= -6.5e-7) || !(y <= 6e+72)) {
tmp = (z - x) * (y / t);
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.5e-7) or not (y <= 6e+72): tmp = (z - x) * (y / t) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.5e-7) || !(y <= 6e+72)) tmp = Float64(Float64(z - x) * Float64(y / t)); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.5e-7) || ~((y <= 6e+72))) tmp = (z - x) * (y / t); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.5e-7], N[Not[LessEqual[y, 6e+72]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-7} \lor \neg \left(y \leq 6 \cdot 10^{+72}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if y < -6.50000000000000024e-7 or 6.00000000000000006e72 < y Initial program 87.1%
Taylor expanded in y around -inf 79.1%
*-commutative79.1%
associate-/l*89.4%
Applied egg-rr89.4%
if -6.50000000000000024e-7 < y < 6.00000000000000006e72Initial program 97.9%
Taylor expanded in z around inf 88.8%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.5e-79) (not (<= z 2.6e-96))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-79) || !(z <= 2.6e-96)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (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 <= (-3.5d-79)) .or. (.not. (z <= 2.6d-96))) then
tmp = x + (y * (z / t))
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-79) || !(z <= 2.6e-96)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.5e-79) or not (z <= 2.6e-96): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.5e-79) || !(z <= 2.6e-96)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.5e-79) || ~((z <= 2.6e-96))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.5e-79], N[Not[LessEqual[z, 2.6e-96]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-79} \lor \neg \left(z \leq 2.6 \cdot 10^{-96}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -3.5000000000000003e-79 or 2.6000000000000002e-96 < z Initial program 92.2%
Taylor expanded in z around inf 83.3%
associate-/l*86.1%
Simplified86.1%
if -3.5000000000000003e-79 < z < 2.6000000000000002e-96Initial program 94.2%
Taylor expanded in x around inf 92.2%
mul-1-neg92.2%
unsub-neg92.2%
Simplified92.2%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.9e-42) (not (<= y 4.5e+66))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.9e-42) || !(y <= 4.5e+66)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (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.9d-42)) .or. (.not. (y <= 4.5d+66))) then
tmp = (z - x) * (y / t)
else
tmp = x * (1.0d0 - (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.9e-42) || !(y <= 4.5e+66)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.9e-42) or not (y <= 4.5e+66): tmp = (z - x) * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.9e-42) || !(y <= 4.5e+66)) tmp = Float64(Float64(z - x) * Float64(y / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.9e-42) || ~((y <= 4.5e+66))) tmp = (z - x) * (y / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.9e-42], N[Not[LessEqual[y, 4.5e+66]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-42} \lor \neg \left(y \leq 4.5 \cdot 10^{+66}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -2.9000000000000003e-42 or 4.4999999999999998e66 < y Initial program 88.0%
Taylor expanded in y around -inf 78.3%
*-commutative78.3%
associate-/l*87.8%
Applied egg-rr87.8%
if -2.9000000000000003e-42 < y < 4.4999999999999998e66Initial program 97.7%
Taylor expanded in x around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
Simplified81.1%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (<= y -6.5e-7) (/ y (/ t (- z x))) (if (<= y 5.2e+72) (+ x (/ (* z y) t)) (* (- z x) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e-7) {
tmp = y / (t / (z - x));
} else if (y <= 5.2e+72) {
tmp = x + ((z * y) / t);
} else {
tmp = (z - 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 <= (-6.5d-7)) then
tmp = y / (t / (z - x))
else if (y <= 5.2d+72) then
tmp = x + ((z * y) / t)
else
tmp = (z - 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 <= -6.5e-7) {
tmp = y / (t / (z - x));
} else if (y <= 5.2e+72) {
tmp = x + ((z * y) / t);
} else {
tmp = (z - x) * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.5e-7: tmp = y / (t / (z - x)) elif y <= 5.2e+72: tmp = x + ((z * y) / t) else: tmp = (z - x) * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.5e-7) tmp = Float64(y / Float64(t / Float64(z - x))); elseif (y <= 5.2e+72) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = Float64(Float64(z - x) * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.5e-7) tmp = y / (t / (z - x)); elseif (y <= 5.2e+72) tmp = x + ((z * y) / t); else tmp = (z - x) * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.5e-7], N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e+72], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+72}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -6.50000000000000024e-7Initial program 90.2%
Taylor expanded in y around -inf 77.7%
associate-/l*99.8%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr85.9%
if -6.50000000000000024e-7 < y < 5.19999999999999963e72Initial program 97.9%
Taylor expanded in z around inf 88.8%
if 5.19999999999999963e72 < y Initial program 82.9%
Taylor expanded in y around -inf 81.0%
*-commutative81.0%
associate-/l*96.0%
Applied egg-rr96.0%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (<= z -7.1e+161) (* y (/ z t)) (if (<= z 4e+149) (* x (- 1.0 (/ y t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.1e+161) {
tmp = y * (z / t);
} else if (z <= 4e+149) {
tmp = x * (1.0 - (y / t));
} else {
tmp = 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 (z <= (-7.1d+161)) then
tmp = y * (z / t)
else if (z <= 4d+149) then
tmp = x * (1.0d0 - (y / t))
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.1e+161) {
tmp = y * (z / t);
} else if (z <= 4e+149) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.1e+161: tmp = y * (z / t) elif z <= 4e+149: tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.1e+161) tmp = Float64(y * Float64(z / t)); elseif (z <= 4e+149) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.1e+161) tmp = y * (z / t); elseif (z <= 4e+149) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.1e+161], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+149], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{+161}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+149}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -7.0999999999999997e161Initial program 87.0%
Taylor expanded in y around inf 76.4%
Taylor expanded in z around inf 76.6%
if -7.0999999999999997e161 < z < 4.0000000000000002e149Initial program 95.4%
Taylor expanded in x around inf 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
if 4.0000000000000002e149 < z Initial program 86.1%
Taylor expanded in y around -inf 65.9%
*-commutative65.9%
associate-/l*77.4%
Applied egg-rr77.4%
Taylor expanded in z around inf 59.4%
*-commutative59.4%
associate-*r/70.9%
Simplified70.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.3e-42) (not (<= y 4.6e+67))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.3e-42) || !(y <= 4.6e+67)) {
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 ((y <= (-1.3d-42)) .or. (.not. (y <= 4.6d+67))) 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 ((y <= -1.3e-42) || !(y <= 4.6e+67)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.3e-42) or not (y <= 4.6e+67): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.3e-42) || !(y <= 4.6e+67)) 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 ((y <= -1.3e-42) || ~((y <= 4.6e+67))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.3e-42], N[Not[LessEqual[y, 4.6e+67]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-42} \lor \neg \left(y \leq 4.6 \cdot 10^{+67}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.3e-42 or 4.5999999999999997e67 < y Initial program 87.9%
Taylor expanded in y around -inf 78.1%
*-commutative78.1%
associate-/l*87.7%
Applied egg-rr87.7%
Taylor expanded in z around inf 48.3%
*-commutative48.3%
associate-*r/57.7%
Simplified57.7%
if -1.3e-42 < y < 4.5999999999999997e67Initial program 97.7%
Taylor expanded in y around 0 72.1%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.52e-40) (not (<= y 3.85e+67))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.52e-40) || !(y <= 3.85e+67)) {
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 ((y <= (-1.52d-40)) .or. (.not. (y <= 3.85d+67))) 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 ((y <= -1.52e-40) || !(y <= 3.85e+67)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.52e-40) or not (y <= 3.85e+67): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.52e-40) || !(y <= 3.85e+67)) 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 ((y <= -1.52e-40) || ~((y <= 3.85e+67))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.52e-40], N[Not[LessEqual[y, 3.85e+67]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.52 \cdot 10^{-40} \lor \neg \left(y \leq 3.85 \cdot 10^{+67}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.51999999999999992e-40 or 3.8500000000000001e67 < y Initial program 87.9%
Taylor expanded in y around inf 85.4%
Taylor expanded in z around inf 54.3%
if -1.51999999999999992e-40 < y < 3.8500000000000001e67Initial program 97.7%
Taylor expanded in y around 0 72.1%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 (if (<= y -3.7e-42) (/ z (/ t y)) (if (<= y 5.2e+67) x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.7e-42) {
tmp = z / (t / y);
} else if (y <= 5.2e+67) {
tmp = x;
} else {
tmp = 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 <= (-3.7d-42)) then
tmp = z / (t / y)
else if (y <= 5.2d+67) then
tmp = x
else
tmp = 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 <= -3.7e-42) {
tmp = z / (t / y);
} else if (y <= 5.2e+67) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.7e-42: tmp = z / (t / y) elif y <= 5.2e+67: tmp = x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.7e-42) tmp = Float64(z / Float64(t / y)); elseif (y <= 5.2e+67) tmp = x; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.7e-42) tmp = z / (t / y); elseif (y <= 5.2e+67) tmp = x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.7e-42], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e+67], x, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{-42}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -3.7000000000000002e-42Initial program 91.0%
Taylor expanded in y around -inf 76.9%
*-commutative76.9%
associate-/l*83.1%
Applied egg-rr83.1%
Taylor expanded in z around inf 44.9%
*-commutative44.9%
associate-*r/53.2%
Simplified53.2%
clear-num53.2%
un-div-inv53.3%
Applied egg-rr53.3%
if -3.7000000000000002e-42 < y < 5.2000000000000001e67Initial program 97.7%
Taylor expanded in y around 0 72.1%
if 5.2000000000000001e67 < y Initial program 83.6%
Taylor expanded in y around -inf 79.9%
*-commutative79.9%
associate-/l*94.3%
Applied egg-rr94.3%
Taylor expanded in z around inf 53.0%
*-commutative53.0%
associate-*r/64.0%
Simplified64.0%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (/ y t))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (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 + ((z - x) * (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y / t));
}
def code(x, y, z, t): return x + ((z - x) * (y / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \frac{y}{t}
\end{array}
Initial program 92.9%
+-commutative92.9%
*-commutative92.9%
associate-/l*98.7%
Applied egg-rr98.7%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (+ x (/ y (/ t (- z x)))))
double code(double x, double y, double z, double t) {
return x + (y / (t / (z - 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 + (y / (t / (z - x)))
end function
public static double code(double x, double y, double z, double t) {
return x + (y / (t / (z - x)));
}
def code(x, y, z, t): return x + (y / (t / (z - x)))
function code(x, y, z, t) return Float64(x + Float64(y / Float64(t / Float64(z - x)))) end
function tmp = code(x, y, z, t) tmp = x + (y / (t / (z - x))); end
code[x_, y_, z_, t_] := N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{t}{z - x}}
\end{array}
Initial program 92.9%
associate-/l*95.0%
clear-num95.0%
un-div-inv95.2%
Applied egg-rr95.2%
(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 92.9%
Taylor expanded in y around 0 43.1%
(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 2024096
(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)))