
(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 12 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 (if (<= y -1.5e+79) (+ x (* y (/ (- z x) t))) (fma (/ y t) (- z x) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.5e+79) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = fma((y / t), (z - x), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.5e+79) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = fma(Float64(y / t), Float64(z - x), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e+79], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+79}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\end{array}
\end{array}
if y < -1.49999999999999987e79Initial program 86.0%
+-commutative86.0%
associate-*l/88.1%
fma-def88.1%
Simplified88.1%
fma-udef88.1%
associate-/r/97.3%
div-inv97.3%
clear-num97.4%
Applied egg-rr97.4%
if -1.49999999999999987e79 < y Initial program 93.7%
+-commutative93.7%
associate-*l/98.6%
fma-def98.6%
Simplified98.6%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.4e-89) (not (<= z 1.3e+29))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e-89) || !(z <= 1.3e+29)) {
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 <= (-6.4d-89)) .or. (.not. (z <= 1.3d+29))) 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 <= -6.4e-89) || !(z <= 1.3e+29)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.4e-89) or not (z <= 1.3e+29): 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 <= -6.4e-89) || !(z <= 1.3e+29)) 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 <= -6.4e-89) || ~((z <= 1.3e+29))) 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, -6.4e-89], N[Not[LessEqual[z, 1.3e+29]], $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 -6.4 \cdot 10^{-89} \lor \neg \left(z \leq 1.3 \cdot 10^{+29}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -6.39999999999999997e-89 or 1.3e29 < z Initial program 89.8%
associate-*l/99.3%
Simplified99.3%
associate-/r/93.3%
div-inv93.2%
associate-/r*99.3%
Applied egg-rr99.3%
Taylor expanded in z around inf 85.9%
associate-*r/86.0%
Simplified86.0%
if -6.39999999999999997e-89 < z < 1.3e29Initial program 94.5%
associate-*l/93.0%
Simplified93.0%
Taylor expanded in x around inf 86.1%
distribute-lft-in86.1%
*-rgt-identity86.1%
mul-1-neg86.1%
distribute-rgt-neg-in86.1%
unsub-neg86.1%
Simplified86.1%
Taylor expanded in x around 0 86.1%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.45e-83) (not (<= z 3.7e+27))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 3.7e+27)) {
tmp = x + (z * (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 ((z <= (-2.45d-83)) .or. (.not. (z <= 3.7d+27))) then
tmp = x + (z * (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 ((z <= -2.45e-83) || !(z <= 3.7e+27)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.45e-83) or not (z <= 3.7e+27): tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.45e-83) || !(z <= 3.7e+27)) tmp = Float64(x + Float64(z * 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 ((z <= -2.45e-83) || ~((z <= 3.7e+27))) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.45e-83], N[Not[LessEqual[z, 3.7e+27]], $MachinePrecision]], N[(x + N[(z * N[(y / 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 -2.45 \cdot 10^{-83} \lor \neg \left(z \leq 3.7 \cdot 10^{+27}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.45e-83 or 3.70000000000000002e27 < z Initial program 89.8%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in z around inf 85.9%
associate-*l/91.1%
*-commutative91.1%
Simplified91.1%
if -2.45e-83 < z < 3.70000000000000002e27Initial program 94.5%
associate-*l/93.0%
Simplified93.0%
Taylor expanded in x around inf 86.1%
distribute-lft-in86.1%
*-rgt-identity86.1%
mul-1-neg86.1%
distribute-rgt-neg-in86.1%
unsub-neg86.1%
Simplified86.1%
Taylor expanded in x around 0 86.1%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.45e-83) (not (<= z 1.35e+30))) (+ x (* z (/ y t))) (- x (* x (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 1.35e+30)) {
tmp = x + (z * (y / t));
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.45d-83)) .or. (.not. (z <= 1.35d+30))) then
tmp = x + (z * (y / t))
else
tmp = x - (x * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.45e-83) || !(z <= 1.35e+30)) {
tmp = x + (z * (y / t));
} else {
tmp = x - (x * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.45e-83) or not (z <= 1.35e+30): tmp = x + (z * (y / t)) else: tmp = x - (x * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.45e-83) || !(z <= 1.35e+30)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x - Float64(x * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.45e-83) || ~((z <= 1.35e+30))) tmp = x + (z * (y / t)); else tmp = x - (x * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.45e-83], N[Not[LessEqual[z, 1.35e+30]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{-83} \lor \neg \left(z \leq 1.35 \cdot 10^{+30}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -2.45e-83 or 1.3499999999999999e30 < z Initial program 89.8%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in z around inf 85.9%
associate-*l/91.1%
*-commutative91.1%
Simplified91.1%
if -2.45e-83 < z < 1.3499999999999999e30Initial program 94.5%
associate-*l/93.0%
Simplified93.0%
Taylor expanded in x around inf 86.1%
distribute-lft-in86.1%
*-rgt-identity86.1%
mul-1-neg86.1%
distribute-rgt-neg-in86.1%
unsub-neg86.1%
Simplified86.1%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.52e-86) (not (<= z 1.6e+27))) (+ x (* z (/ y t))) (- x (* y (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.52e-86) || !(z <= 1.6e+27)) {
tmp = x + (z * (y / t));
} else {
tmp = x - (y * (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 ((z <= (-1.52d-86)) .or. (.not. (z <= 1.6d+27))) then
tmp = x + (z * (y / t))
else
tmp = x - (y * (x / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.52e-86) || !(z <= 1.6e+27)) {
tmp = x + (z * (y / t));
} else {
tmp = x - (y * (x / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.52e-86) or not (z <= 1.6e+27): tmp = x + (z * (y / t)) else: tmp = x - (y * (x / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.52e-86) || !(z <= 1.6e+27)) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = Float64(x - Float64(y * Float64(x / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.52e-86) || ~((z <= 1.6e+27))) tmp = x + (z * (y / t)); else tmp = x - (y * (x / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.52e-86], N[Not[LessEqual[z, 1.6e+27]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.52 \cdot 10^{-86} \lor \neg \left(z \leq 1.6 \cdot 10^{+27}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{x}{t}\\
\end{array}
\end{array}
if z < -1.52e-86 or 1.60000000000000008e27 < z Initial program 89.8%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in z around inf 85.9%
associate-*l/91.1%
*-commutative91.1%
Simplified91.1%
if -1.52e-86 < z < 1.60000000000000008e27Initial program 94.5%
associate-*l/93.0%
Simplified93.0%
associate-/r/97.9%
div-inv97.9%
associate-/r*92.9%
Applied egg-rr92.9%
Taylor expanded in x around inf 86.1%
mul-1-neg86.1%
unsub-neg86.1%
distribute-rgt-out--86.1%
*-lft-identity86.1%
associate-*l/85.3%
associate-*r/88.3%
Simplified88.3%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (<= y -4e+79) (+ x (/ y (/ t (- z x)))) (+ x (* (- z x) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e+79) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = x + ((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 <= (-4d+79)) then
tmp = x + (y / (t / (z - x)))
else
tmp = x + ((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 <= -4e+79) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = x + ((z - x) * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4e+79: tmp = x + (y / (t / (z - x))) else: tmp = x + ((z - x) * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4e+79) tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); else tmp = Float64(x + Float64(Float64(z - x) * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4e+79) tmp = x + (y / (t / (z - x))); else tmp = x + ((z - x) * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4e+79], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+79}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -3.99999999999999987e79Initial program 86.0%
associate-/l*97.3%
Simplified97.3%
if -3.99999999999999987e79 < y Initial program 93.7%
associate-*l/98.6%
Simplified98.6%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.15e+79) (+ x (* y (/ (- z x) t))) (+ x (* (- z x) (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e+79) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x + ((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 <= (-1.15d+79)) then
tmp = x + (y * ((z - x) / t))
else
tmp = x + ((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 <= -1.15e+79) {
tmp = x + (y * ((z - x) / t));
} else {
tmp = x + ((z - x) * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.15e+79: tmp = x + (y * ((z - x) / t)) else: tmp = x + ((z - x) * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.15e+79) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); else tmp = Float64(x + Float64(Float64(z - x) * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.15e+79) tmp = x + (y * ((z - x) / t)); else tmp = x + ((z - x) * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.15e+79], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+79}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.15e79Initial program 86.0%
+-commutative86.0%
associate-*l/88.1%
fma-def88.1%
Simplified88.1%
fma-udef88.1%
associate-/r/97.3%
div-inv97.3%
clear-num97.4%
Applied egg-rr97.4%
if -1.15e79 < y Initial program 93.7%
associate-*l/98.6%
Simplified98.6%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (<= t -4.3e-108) x (if (<= t 7.5e-23) (* x (- (/ y t))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.3e-108) {
tmp = x;
} else if (t <= 7.5e-23) {
tmp = x * -(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 <= (-4.3d-108)) then
tmp = x
else if (t <= 7.5d-23) then
tmp = x * -(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 <= -4.3e-108) {
tmp = x;
} else if (t <= 7.5e-23) {
tmp = x * -(y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.3e-108: tmp = x elif t <= 7.5e-23: tmp = x * -(y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.3e-108) tmp = x; elseif (t <= 7.5e-23) tmp = Float64(x * Float64(-Float64(y / t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.3e-108) tmp = x; elseif (t <= 7.5e-23) tmp = x * -(y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.3e-108], x, If[LessEqual[t, 7.5e-23], N[(x * (-N[(y / t), $MachinePrecision])), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{-108}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-23}:\\
\;\;\;\;x \cdot \left(-\frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.3e-108 or 7.4999999999999998e-23 < t Initial program 88.2%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 56.0%
if -4.3e-108 < t < 7.4999999999999998e-23Initial program 97.2%
associate-*l/93.9%
Simplified93.9%
Taylor expanded in x around inf 57.4%
distribute-lft-in57.4%
*-rgt-identity57.4%
mul-1-neg57.4%
distribute-rgt-neg-in57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in y around inf 53.0%
mul-1-neg53.0%
associate-*r/52.0%
distribute-rgt-neg-in52.0%
Simplified52.0%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (if (<= t -2.7e-108) x (if (<= t 2.5e-23) (* y (/ (- x) t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.7e-108) {
tmp = x;
} else if (t <= 2.5e-23) {
tmp = y * (-x / 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 <= (-2.7d-108)) then
tmp = x
else if (t <= 2.5d-23) then
tmp = y * (-x / 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 <= -2.7e-108) {
tmp = x;
} else if (t <= 2.5e-23) {
tmp = y * (-x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.7e-108: tmp = x elif t <= 2.5e-23: tmp = y * (-x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.7e-108) tmp = x; elseif (t <= 2.5e-23) tmp = Float64(y * Float64(Float64(-x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.7e-108) tmp = x; elseif (t <= 2.5e-23) tmp = y * (-x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.7e-108], x, If[LessEqual[t, 2.5e-23], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-108}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{-23}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.70000000000000005e-108 or 2.5000000000000001e-23 < t Initial program 88.2%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in y around 0 56.0%
if -2.70000000000000005e-108 < t < 2.5000000000000001e-23Initial program 97.2%
associate-*l/93.9%
Simplified93.9%
Taylor expanded in x around inf 57.4%
distribute-lft-in57.4%
*-rgt-identity57.4%
mul-1-neg57.4%
distribute-rgt-neg-in57.4%
unsub-neg57.4%
Simplified57.4%
Taylor expanded in y around inf 53.0%
associate-*l/53.5%
associate-*r*53.5%
neg-mul-153.5%
*-commutative53.5%
Simplified53.5%
Final simplification54.9%
(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.0%
associate-*l/96.3%
Simplified96.3%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 (/ y t))))
double code(double x, double y, double z, double t) {
return x * (1.0 - (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 * (1.0d0 - (y / t))
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - (y / t));
}
def code(x, y, z, t): return x * (1.0 - (y / t))
function code(x, y, z, t) return Float64(x * Float64(1.0 - Float64(y / t))) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - (y / t)); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - \frac{y}{t}\right)
\end{array}
Initial program 92.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in x around inf 65.3%
distribute-lft-in65.3%
*-rgt-identity65.3%
mul-1-neg65.3%
distribute-rgt-neg-in65.3%
unsub-neg65.3%
Simplified65.3%
Taylor expanded in x around 0 65.3%
Final simplification65.3%
(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.0%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in y around 0 35.1%
Final simplification35.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 2023297
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))