
(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 10 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 (fma (/ y t) (- z x) x))
double code(double x, double y, double z, double t) {
return fma((y / t), (z - x), x);
}
function code(x, y, z, t) return fma(Float64(y / t), Float64(z - x), x) end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)
\end{array}
Initial program 91.5%
+-commutative91.5%
associate-*l/98.0%
fma-def98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e+49) (not (<= z 2.8e-20))) (+ x (* (/ y t) z)) (+ x (/ x (/ (- t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e+49) || !(z <= 2.8e-20)) {
tmp = x + ((y / t) * z);
} else {
tmp = x + (x / (-t / y));
}
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.5d+49)) .or. (.not. (z <= 2.8d-20))) then
tmp = x + ((y / t) * z)
else
tmp = x + (x / (-t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e+49) || !(z <= 2.8e-20)) {
tmp = x + ((y / t) * z);
} else {
tmp = x + (x / (-t / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.5e+49) or not (z <= 2.8e-20): tmp = x + ((y / t) * z) else: tmp = x + (x / (-t / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.5e+49) || !(z <= 2.8e-20)) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x + Float64(x / Float64(Float64(-t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.5e+49) || ~((z <= 2.8e-20))) tmp = x + ((y / t) * z); else tmp = x + (x / (-t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.5e+49], N[Not[LessEqual[z, 2.8e-20]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(x / N[((-t) / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+49} \lor \neg \left(z \leq 2.8 \cdot 10^{-20}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{x}{\frac{-t}{y}}\\
\end{array}
\end{array}
if z < -6.5000000000000005e49 or 2.8000000000000003e-20 < z Initial program 89.9%
+-commutative89.9%
associate-*l/99.1%
fma-def99.1%
Simplified99.1%
fma-udef99.1%
associate-*l/89.9%
*-commutative89.9%
associate-/l*98.9%
Applied egg-rr98.9%
Taylor expanded in z around inf 84.7%
*-commutative84.7%
associate-*r/92.5%
Simplified92.5%
if -6.5000000000000005e49 < z < 2.8000000000000003e-20Initial program 93.0%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around 0 84.3%
associate-*r/84.3%
mul-1-neg84.3%
distribute-lft-neg-out84.3%
*-lft-identity84.3%
associate-*l/84.3%
associate-*r*85.2%
*-commutative85.2%
associate-*l/85.2%
*-commutative85.2%
*-rgt-identity85.2%
Simplified85.2%
associate-*r/84.3%
*-commutative84.3%
associate-/l*88.9%
add-sqr-sqrt47.6%
sqrt-unprod53.2%
sqr-neg53.2%
sqrt-unprod22.4%
add-sqr-sqrt44.3%
frac-2neg44.3%
add-sqr-sqrt21.8%
sqrt-unprod44.7%
sqr-neg44.7%
sqrt-unprod41.2%
add-sqr-sqrt88.9%
distribute-neg-frac88.9%
Applied egg-rr88.9%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e+49) (not (<= z 4.8e-20))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e+49) || !(z <= 4.8e-20)) {
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.5d+49)) .or. (.not. (z <= 4.8d-20))) 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.5e+49) || !(z <= 4.8e-20)) {
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.5e+49) or not (z <= 4.8e-20): 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.5e+49) || !(z <= 4.8e-20)) 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.5e+49) || ~((z <= 4.8e-20))) 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.5e+49], N[Not[LessEqual[z, 4.8e-20]], $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.5 \cdot 10^{+49} \lor \neg \left(z \leq 4.8 \cdot 10^{-20}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -6.5000000000000005e49 or 4.79999999999999986e-20 < z Initial program 89.9%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in z around inf 84.7%
*-commutative84.7%
associate-/l*92.4%
associate-/r/85.7%
Simplified85.7%
if -6.5000000000000005e49 < z < 4.79999999999999986e-20Initial program 93.0%
+-commutative93.0%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
fma-udef97.1%
associate-*l/93.0%
*-commutative93.0%
associate-/l*97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 84.3%
*-lft-identity84.3%
associate-*r/88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-in88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.62e+50) (not (<= z 6.5e-20))) (+ x (/ y (/ t z))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.62e+50) || !(z <= 6.5e-20)) {
tmp = x + (y / (t / z));
} 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 <= (-1.62d+50)) .or. (.not. (z <= 6.5d-20))) then
tmp = x + (y / (t / z))
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 <= -1.62e+50) || !(z <= 6.5e-20)) {
tmp = x + (y / (t / z));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.62e+50) or not (z <= 6.5e-20): tmp = x + (y / (t / z)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.62e+50) || !(z <= 6.5e-20)) tmp = Float64(x + Float64(y / Float64(t / z))); 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 <= -1.62e+50) || ~((z <= 6.5e-20))) tmp = x + (y / (t / z)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.62e+50], N[Not[LessEqual[z, 6.5e-20]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.62 \cdot 10^{+50} \lor \neg \left(z \leq 6.5 \cdot 10^{-20}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.61999999999999996e50 or 6.50000000000000032e-20 < z Initial program 89.9%
associate-*l/99.1%
Simplified99.1%
Taylor expanded in z around inf 84.7%
associate-/l*86.9%
Simplified86.9%
if -1.61999999999999996e50 < z < 6.50000000000000032e-20Initial program 93.0%
+-commutative93.0%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
fma-udef97.1%
associate-*l/93.0%
*-commutative93.0%
associate-/l*97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 84.3%
*-lft-identity84.3%
associate-*r/88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-in88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.8e+49) (not (<= z 6e-20))) (+ x (* (/ y t) z)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e+49) || !(z <= 6e-20)) {
tmp = x + ((y / t) * z);
} 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 <= (-8.8d+49)) .or. (.not. (z <= 6d-20))) then
tmp = x + ((y / t) * z)
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 <= -8.8e+49) || !(z <= 6e-20)) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.8e+49) or not (z <= 6e-20): tmp = x + ((y / t) * z) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.8e+49) || !(z <= 6e-20)) tmp = Float64(x + Float64(Float64(y / t) * z)); 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 <= -8.8e+49) || ~((z <= 6e-20))) tmp = x + ((y / t) * z); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.8e+49], N[Not[LessEqual[z, 6e-20]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+49} \lor \neg \left(z \leq 6 \cdot 10^{-20}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -8.8000000000000003e49 or 6.00000000000000057e-20 < z Initial program 89.9%
+-commutative89.9%
associate-*l/99.1%
fma-def99.1%
Simplified99.1%
fma-udef99.1%
associate-*l/89.9%
*-commutative89.9%
associate-/l*98.9%
Applied egg-rr98.9%
Taylor expanded in z around inf 84.7%
*-commutative84.7%
associate-*r/92.5%
Simplified92.5%
if -8.8000000000000003e49 < z < 6.00000000000000057e-20Initial program 93.0%
+-commutative93.0%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
fma-udef97.1%
associate-*l/93.0%
*-commutative93.0%
associate-/l*97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 84.3%
*-lft-identity84.3%
associate-*r/88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-in88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (<= z -2.7e+51) (+ x (/ y (/ t z))) (if (<= z 4.6e-20) (* x (- 1.0 (/ y t))) (+ x (/ (* y z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e+51) {
tmp = x + (y / (t / z));
} else if (z <= 4.6e-20) {
tmp = x * (1.0 - (y / 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 (z <= (-2.7d+51)) then
tmp = x + (y / (t / z))
else if (z <= 4.6d-20) then
tmp = x * (1.0d0 - (y / 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 (z <= -2.7e+51) {
tmp = x + (y / (t / z));
} else if (z <= 4.6e-20) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.7e+51: tmp = x + (y / (t / z)) elif z <= 4.6e-20: tmp = x * (1.0 - (y / t)) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e+51) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (z <= 4.6e-20) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.7e+51) tmp = x + (y / (t / z)); elseif (z <= 4.6e-20) tmp = x * (1.0 - (y / t)); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e+51], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-20], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+51}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-20}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -2.69999999999999992e51Initial program 90.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 87.9%
associate-/l*93.7%
Simplified93.7%
if -2.69999999999999992e51 < z < 4.5999999999999998e-20Initial program 93.0%
+-commutative93.0%
associate-*l/97.1%
fma-def97.1%
Simplified97.1%
fma-udef97.1%
associate-*l/93.0%
*-commutative93.0%
associate-/l*97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 84.3%
*-lft-identity84.3%
associate-*r/88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-in88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
if 4.5999999999999998e-20 < z Initial program 89.9%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in z around inf 82.7%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (if (<= t -0.0028) x (if (<= t 7.5) (* y (/ (- x) t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -0.0028) {
tmp = x;
} else if (t <= 7.5) {
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 <= (-0.0028d0)) then
tmp = x
else if (t <= 7.5d0) 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 <= -0.0028) {
tmp = x;
} else if (t <= 7.5) {
tmp = y * (-x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -0.0028: tmp = x elif t <= 7.5: tmp = y * (-x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -0.0028) tmp = x; elseif (t <= 7.5) 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 <= -0.0028) tmp = x; elseif (t <= 7.5) tmp = y * (-x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -0.0028], x, If[LessEqual[t, 7.5], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.0028:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 7.5:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -0.00279999999999999997 or 7.5 < t Initial program 86.6%
associate-*l/99.2%
Simplified99.2%
Taylor expanded in y around 0 55.5%
if -0.00279999999999999997 < t < 7.5Initial program 96.9%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in z around 0 55.4%
associate-*r/55.4%
mul-1-neg55.4%
distribute-lft-neg-out55.4%
*-lft-identity55.4%
associate-*l/55.3%
associate-*r*50.8%
*-commutative50.8%
associate-*l/50.8%
*-commutative50.8%
*-rgt-identity50.8%
Simplified50.8%
distribute-frac-neg50.8%
distribute-rgt-neg-out50.8%
add-sqr-sqrt20.7%
sqrt-unprod25.7%
sqr-neg25.7%
sqrt-unprod7.7%
add-sqr-sqrt14.6%
sub-neg14.6%
add-sqr-sqrt7.7%
sqrt-unprod25.7%
sqr-neg25.7%
sqrt-unprod20.7%
add-sqr-sqrt50.8%
Applied egg-rr50.8%
Taylor expanded in y around 0 55.4%
*-commutative55.4%
associate-/l*50.8%
Simplified50.8%
Taylor expanded in y around inf 46.5%
mul-1-neg46.5%
*-commutative46.5%
distribute-frac-neg46.5%
distribute-rgt-neg-out46.5%
associate-*r/42.9%
Simplified42.9%
Final simplification49.5%
(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(Float64(y / 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[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 91.5%
associate-*l/98.0%
Simplified98.0%
Final simplification98.0%
(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 91.5%
+-commutative91.5%
associate-*l/98.0%
fma-def98.1%
Simplified98.1%
fma-udef98.0%
associate-*l/91.5%
*-commutative91.5%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 59.0%
*-lft-identity59.0%
associate-*r/62.4%
*-commutative62.4%
associate-*r*62.4%
distribute-rgt-in62.4%
mul-1-neg62.4%
unsub-neg62.4%
Simplified62.4%
Final simplification62.4%
(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.5%
associate-*l/98.0%
Simplified98.0%
Taylor expanded in y around 0 34.4%
Final simplification34.4%
(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 2023301
(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)))