
(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 (+ x (/ (- z x) (/ t y))))
double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
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) / (t / y))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) / (t / y));
}
def code(x, y, z, t): return x + ((z - x) / (t / y))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) / Float64(t / y))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) / (t / y)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - x}{\frac{t}{y}}
\end{array}
Initial program 91.3%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
associate-/l*88.8%
distribute-lft-neg-in88.8%
*-commutative88.8%
associate-*r/92.8%
distribute-rgt-in98.7%
+-commutative98.7%
sub-neg98.7%
Simplified98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv98.7%
Applied egg-rr98.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.05e-23) (* y (/ z t)) (if (<= z 3.2e-294) (/ y (/ t (- x))) (if (<= z 1.6e-9) x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e-23) {
tmp = y * (z / t);
} else if (z <= 3.2e-294) {
tmp = y / (t / -x);
} else if (z <= 1.6e-9) {
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 (z <= (-1.05d-23)) then
tmp = y * (z / t)
else if (z <= 3.2d-294) then
tmp = y / (t / -x)
else if (z <= 1.6d-9) 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 (z <= -1.05e-23) {
tmp = y * (z / t);
} else if (z <= 3.2e-294) {
tmp = y / (t / -x);
} else if (z <= 1.6e-9) {
tmp = x;
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.05e-23: tmp = y * (z / t) elif z <= 3.2e-294: tmp = y / (t / -x) elif z <= 1.6e-9: tmp = x else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e-23) tmp = Float64(y * Float64(z / t)); elseif (z <= 3.2e-294) tmp = Float64(y / Float64(t / Float64(-x))); elseif (z <= 1.6e-9) tmp = x; else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.05e-23) tmp = y * (z / t); elseif (z <= 3.2e-294) tmp = y / (t / -x); elseif (z <= 1.6e-9) tmp = x; else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e-23], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-294], N[(y / N[(t / (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e-9], x, N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-23}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-294}:\\
\;\;\;\;\frac{y}{\frac{t}{-x}}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1.05e-23Initial program 90.4%
Taylor expanded in y around -inf 70.0%
Taylor expanded in z around inf 64.3%
associate-/l*90.2%
Simplified69.8%
if -1.05e-23 < z < 3.20000000000000019e-294Initial program 89.7%
Taylor expanded in x around inf 91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
Taylor expanded in y around inf 54.4%
mul-1-neg54.4%
distribute-frac-neg254.4%
Simplified54.4%
*-commutative54.4%
associate-/r/54.5%
frac-2neg54.5%
distribute-frac-neg54.5%
remove-double-neg54.5%
Applied egg-rr54.5%
if 3.20000000000000019e-294 < z < 1.60000000000000006e-9Initial program 95.8%
Taylor expanded in y around 0 58.6%
if 1.60000000000000006e-9 < z Initial program 90.2%
Taylor expanded in y around -inf 75.1%
Taylor expanded in z around inf 64.7%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e-25) (* y (/ z t)) (if (<= z 8e-294) (* y (/ x (- t))) (if (<= z 1.5e-9) x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e-25) {
tmp = y * (z / t);
} else if (z <= 8e-294) {
tmp = y * (x / -t);
} else if (z <= 1.5e-9) {
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 (z <= (-1.8d-25)) then
tmp = y * (z / t)
else if (z <= 8d-294) then
tmp = y * (x / -t)
else if (z <= 1.5d-9) 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 (z <= -1.8e-25) {
tmp = y * (z / t);
} else if (z <= 8e-294) {
tmp = y * (x / -t);
} else if (z <= 1.5e-9) {
tmp = x;
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e-25: tmp = y * (z / t) elif z <= 8e-294: tmp = y * (x / -t) elif z <= 1.5e-9: tmp = x else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e-25) tmp = Float64(y * Float64(z / t)); elseif (z <= 8e-294) tmp = Float64(y * Float64(x / Float64(-t))); elseif (z <= 1.5e-9) tmp = x; else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e-25) tmp = y * (z / t); elseif (z <= 8e-294) tmp = y * (x / -t); elseif (z <= 1.5e-9) tmp = x; else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e-25], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-294], N[(y * N[(x / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e-9], x, N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-25}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-294}:\\
\;\;\;\;y \cdot \frac{x}{-t}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1.8e-25Initial program 90.4%
Taylor expanded in y around -inf 70.0%
Taylor expanded in z around inf 64.3%
associate-/l*90.2%
Simplified69.8%
if -1.8e-25 < z < 8.00000000000000013e-294Initial program 89.7%
Taylor expanded in x around inf 91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
Taylor expanded in y around inf 54.4%
mul-1-neg54.4%
distribute-frac-neg254.4%
Simplified54.4%
Taylor expanded in x around 0 47.7%
mul-1-neg47.7%
associate-*l/54.4%
distribute-rgt-neg-in54.4%
Simplified54.4%
if 8.00000000000000013e-294 < z < 1.49999999999999999e-9Initial program 95.8%
Taylor expanded in y around 0 58.6%
if 1.49999999999999999e-9 < z Initial program 90.2%
Taylor expanded in y around -inf 75.1%
Taylor expanded in z around inf 64.7%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (<= z -9.6e-24) (* y (/ z t)) (if (<= z 3.5e-293) (* (/ y t) (- x)) (if (<= z 6.4e-9) x (/ (* z y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.6e-24) {
tmp = y * (z / t);
} else if (z <= 3.5e-293) {
tmp = (y / t) * -x;
} else if (z <= 6.4e-9) {
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 (z <= (-9.6d-24)) then
tmp = y * (z / t)
else if (z <= 3.5d-293) then
tmp = (y / t) * -x
else if (z <= 6.4d-9) 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 (z <= -9.6e-24) {
tmp = y * (z / t);
} else if (z <= 3.5e-293) {
tmp = (y / t) * -x;
} else if (z <= 6.4e-9) {
tmp = x;
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.6e-24: tmp = y * (z / t) elif z <= 3.5e-293: tmp = (y / t) * -x elif z <= 6.4e-9: tmp = x else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.6e-24) tmp = Float64(y * Float64(z / t)); elseif (z <= 3.5e-293) tmp = Float64(Float64(y / t) * Float64(-x)); elseif (z <= 6.4e-9) tmp = x; else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.6e-24) tmp = y * (z / t); elseif (z <= 3.5e-293) tmp = (y / t) * -x; elseif (z <= 6.4e-9) tmp = x; else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.6e-24], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-293], N[(N[(y / t), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, 6.4e-9], x, N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{-24}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-293}:\\
\;\;\;\;\frac{y}{t} \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -9.5999999999999993e-24Initial program 90.4%
Taylor expanded in y around -inf 70.0%
Taylor expanded in z around inf 64.3%
associate-/l*90.2%
Simplified69.8%
if -9.5999999999999993e-24 < z < 3.5000000000000002e-293Initial program 89.7%
Taylor expanded in x around inf 91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
Taylor expanded in y around inf 54.4%
mul-1-neg54.4%
distribute-frac-neg254.4%
Simplified54.4%
if 3.5000000000000002e-293 < z < 6.40000000000000023e-9Initial program 95.8%
Taylor expanded in y around 0 58.6%
if 6.40000000000000023e-9 < z Initial program 90.2%
Taylor expanded in y around -inf 75.1%
Taylor expanded in z around inf 64.7%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-22) (not (<= z 1.12e-70))) (+ x (* z (/ y t))) (* x (/ (- t y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-22) || !(z <= 1.12e-70)) {
tmp = x + (z * (y / t));
} else {
tmp = x * ((t - 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 <= (-1.6d-22)) .or. (.not. (z <= 1.12d-70))) then
tmp = x + (z * (y / t))
else
tmp = x * ((t - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-22) || !(z <= 1.12e-70)) {
tmp = x + (z * (y / t));
} else {
tmp = x * ((t - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-22) or not (z <= 1.12e-70): tmp = x + (z * (y / t)) else: tmp = x * ((t - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-22) || !(z <= 1.12e-70)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x * Float64(Float64(t - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e-22) || ~((z <= 1.12e-70))) tmp = x + (z * (y / t)); else tmp = x * ((t - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-22], N[Not[LessEqual[z, 1.12e-70]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-22} \lor \neg \left(z \leq 1.12 \cdot 10^{-70}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\end{array}
\end{array}
if z < -1.59999999999999994e-22 or 1.12e-70 < z Initial program 90.2%
Taylor expanded in z around 0 84.4%
mul-1-neg84.4%
associate-/l*84.3%
distribute-lft-neg-in84.3%
*-commutative84.3%
associate-*r/91.5%
distribute-rgt-in99.2%
+-commutative99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 89.3%
if -1.59999999999999994e-22 < z < 1.12e-70Initial program 93.2%
Taylor expanded in x around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Taylor expanded in t around 0 90.5%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.05e-25) (not (<= z 2.45e-69))) (+ x (* y (/ z t))) (* x (/ (- t y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.05e-25) || !(z <= 2.45e-69)) {
tmp = x + (y * (z / t));
} else {
tmp = x * ((t - 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 <= (-2.05d-25)) .or. (.not. (z <= 2.45d-69))) then
tmp = x + (y * (z / t))
else
tmp = x * ((t - y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.05e-25) || !(z <= 2.45e-69)) {
tmp = x + (y * (z / t));
} else {
tmp = x * ((t - y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.05e-25) or not (z <= 2.45e-69): tmp = x + (y * (z / t)) else: tmp = x * ((t - y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.05e-25) || !(z <= 2.45e-69)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(Float64(t - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.05e-25) || ~((z <= 2.45e-69))) tmp = x + (y * (z / t)); else tmp = x * ((t - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.05e-25], N[Not[LessEqual[z, 2.45e-69]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-25} \lor \neg \left(z \leq 2.45 \cdot 10^{-69}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\end{array}
\end{array}
if z < -2.04999999999999994e-25 or 2.4499999999999999e-69 < z Initial program 90.2%
Taylor expanded in z around inf 82.6%
associate-/l*84.1%
Simplified84.1%
if -2.04999999999999994e-25 < z < 2.4499999999999999e-69Initial program 93.2%
Taylor expanded in x around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Taylor expanded in t around 0 90.5%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (<= z -9e-23) (+ x (/ z (/ t y))) (if (<= z 1.06e-68) (* x (/ (- t y) t)) (+ x (* z (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e-23) {
tmp = x + (z / (t / y));
} else if (z <= 1.06e-68) {
tmp = x * ((t - 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 (z <= (-9d-23)) then
tmp = x + (z / (t / y))
else if (z <= 1.06d-68) then
tmp = x * ((t - 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 (z <= -9e-23) {
tmp = x + (z / (t / y));
} else if (z <= 1.06e-68) {
tmp = x * ((t - y) / t);
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9e-23: tmp = x + (z / (t / y)) elif z <= 1.06e-68: tmp = x * ((t - y) / t) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9e-23) tmp = Float64(x + Float64(z / Float64(t / y))); elseif (z <= 1.06e-68) tmp = Float64(x * Float64(Float64(t - y) / 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 (z <= -9e-23) tmp = x + (z / (t / y)); elseif (z <= 1.06e-68) tmp = x * ((t - y) / t); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9e-23], N[(x + N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.06e-68], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -8.9999999999999995e-23Initial program 90.4%
Taylor expanded in z around 0 85.9%
mul-1-neg85.9%
associate-/l*87.4%
distribute-lft-neg-in87.4%
*-commutative87.4%
associate-*r/95.4%
distribute-rgt-in99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 92.8%
if -8.9999999999999995e-23 < z < 1.06e-68Initial program 93.2%
Taylor expanded in x around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Taylor expanded in t around 0 90.5%
if 1.06e-68 < z Initial program 90.0%
Taylor expanded in z around 0 83.1%
mul-1-neg83.1%
associate-/l*81.8%
distribute-lft-neg-in81.8%
*-commutative81.8%
associate-*r/88.5%
distribute-rgt-in98.7%
+-commutative98.7%
sub-neg98.7%
Simplified98.7%
Taylor expanded in z around inf 86.6%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.8e+17) (* y (/ z t)) (if (<= z 1.35e+30) (* x (/ (- t y) t)) (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.8e+17) {
tmp = y * (z / t);
} else if (z <= 1.35e+30) {
tmp = x * ((t - 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 <= (-1.8d+17)) then
tmp = y * (z / t)
else if (z <= 1.35d+30) then
tmp = x * ((t - 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 <= -1.8e+17) {
tmp = y * (z / t);
} else if (z <= 1.35e+30) {
tmp = x * ((t - y) / t);
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.8e+17: tmp = y * (z / t) elif z <= 1.35e+30: tmp = x * ((t - y) / t) else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.8e+17) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.35e+30) tmp = Float64(x * Float64(Float64(t - y) / t)); else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.8e+17) tmp = y * (z / t); elseif (z <= 1.35e+30) tmp = x * ((t - y) / t); else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.8e+17], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+30], N[(x * N[(N[(t - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \frac{t - y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1.8e17Initial program 89.8%
Taylor expanded in y around -inf 71.2%
Taylor expanded in z around inf 65.1%
associate-/l*89.6%
Simplified70.9%
if -1.8e17 < z < 1.3499999999999999e30Initial program 93.4%
Taylor expanded in x around inf 85.4%
mul-1-neg85.4%
unsub-neg85.4%
Simplified85.4%
Taylor expanded in t around 0 85.4%
if 1.3499999999999999e30 < z Initial program 89.0%
Taylor expanded in y around -inf 77.4%
Taylor expanded in z around inf 67.3%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1e+17) (* y (/ z t)) (if (<= z 8.5e+30) (* x (- 1.0 (/ y t))) (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+17) {
tmp = y * (z / t);
} else if (z <= 8.5e+30) {
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 <= (-1d+17)) then
tmp = y * (z / t)
else if (z <= 8.5d+30) 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 <= -1e+17) {
tmp = y * (z / t);
} else if (z <= 8.5e+30) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1e+17: tmp = y * (z / t) elif z <= 8.5e+30: tmp = x * (1.0 - (y / t)) else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1e+17) tmp = Float64(y * Float64(z / t)); elseif (z <= 8.5e+30) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1e+17) tmp = y * (z / t); elseif (z <= 8.5e+30) tmp = x * (1.0 - (y / t)); else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1e+17], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+30], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -1e17Initial program 89.8%
Taylor expanded in y around -inf 71.2%
Taylor expanded in z around inf 65.1%
associate-/l*89.6%
Simplified70.9%
if -1e17 < z < 8.4999999999999995e30Initial program 93.4%
Taylor expanded in x around inf 85.4%
mul-1-neg85.4%
unsub-neg85.4%
Simplified85.4%
if 8.4999999999999995e30 < z Initial program 89.0%
Taylor expanded in y around -inf 77.4%
Taylor expanded in z around inf 67.3%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.4e-48) (not (<= z 1.85e-9))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e-48) || !(z <= 1.85e-9)) {
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 ((z <= (-2.4d-48)) .or. (.not. (z <= 1.85d-9))) 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 ((z <= -2.4e-48) || !(z <= 1.85e-9)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.4e-48) or not (z <= 1.85e-9): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.4e-48) || !(z <= 1.85e-9)) 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 ((z <= -2.4e-48) || ~((z <= 1.85e-9))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.4e-48], N[Not[LessEqual[z, 1.85e-9]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-48} \lor \neg \left(z \leq 1.85 \cdot 10^{-9}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.4e-48 or 1.85e-9 < z Initial program 90.7%
Taylor expanded in y around -inf 73.9%
Taylor expanded in z around inf 63.6%
associate-/l*82.4%
Simplified65.2%
if -2.4e-48 < z < 1.85e-9Initial program 92.3%
Taylor expanded in y around 0 52.2%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (if (<= z -2.05e-48) (* y (/ z t)) (if (<= z 1.4e-9) x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e-48) {
tmp = y * (z / t);
} else if (z <= 1.4e-9) {
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 (z <= (-2.05d-48)) then
tmp = y * (z / t)
else if (z <= 1.4d-9) 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 (z <= -2.05e-48) {
tmp = y * (z / t);
} else if (z <= 1.4e-9) {
tmp = x;
} else {
tmp = (z * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.05e-48: tmp = y * (z / t) elif z <= 1.4e-9: tmp = x else: tmp = (z * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e-48) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.4e-9) tmp = x; else tmp = Float64(Float64(z * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.05e-48) tmp = y * (z / t); elseif (z <= 1.4e-9) tmp = x; else tmp = (z * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.05e-48], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e-9], x, N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-48}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}
\end{array}
if z < -2.05000000000000007e-48Initial program 91.2%
Taylor expanded in y around -inf 72.8%
Taylor expanded in z around inf 62.5%
associate-/l*86.2%
Simplified67.5%
if -2.05000000000000007e-48 < z < 1.39999999999999992e-9Initial program 92.3%
Taylor expanded in y around 0 52.2%
if 1.39999999999999992e-9 < z Initial program 90.2%
Taylor expanded in y around -inf 75.1%
Taylor expanded in z around inf 64.7%
Final simplification60.5%
(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 91.3%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
associate-/l*88.8%
distribute-lft-neg-in88.8%
*-commutative88.8%
associate-*r/92.8%
distribute-rgt-in98.7%
+-commutative98.7%
sub-neg98.7%
Simplified98.7%
Final simplification98.7%
(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 91.3%
Taylor expanded in y around 0 32.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 2024141
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))