
(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 9 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 (- z x) (/ y t) x))
double code(double x, double y, double z, double t) {
return fma((z - x), (y / t), x);
}
function code(x, y, z, t) return fma(Float64(z - x), Float64(y / t), x) end
code[x_, y_, z_, t_] := N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)
\end{array}
Initial program 94.6%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
fma-defineN/A
fma-lowering-fma.f64N/A
--lowering--.f64N/A
/-lowering-/.f6496.9%
Applied egg-rr96.9%
(FPCore (x y z t) :precision binary64 (if (<= y -3.1e+59) (/ y (/ t (- z x))) (if (<= y 1.38e+44) (+ x (/ (* z y) t)) (* y (/ (- z x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.1e+59) {
tmp = y / (t / (z - x));
} else if (y <= 1.38e+44) {
tmp = x + ((z * y) / t);
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.1d+59)) then
tmp = y / (t / (z - x))
else if (y <= 1.38d+44) then
tmp = x + ((z * y) / t)
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.1e+59) {
tmp = y / (t / (z - x));
} else if (y <= 1.38e+44) {
tmp = x + ((z * y) / t);
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.1e+59: tmp = y / (t / (z - x)) elif y <= 1.38e+44: tmp = x + ((z * y) / t) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.1e+59) tmp = Float64(y / Float64(t / Float64(z - x))); elseif (y <= 1.38e+44) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.1e+59) tmp = y / (t / (z - x)); elseif (y <= 1.38e+44) tmp = x + ((z * y) / t); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.1e+59], N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.38e+44], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+59}:\\
\;\;\;\;\frac{y}{\frac{t}{z - x}}\\
\mathbf{elif}\;y \leq 1.38 \cdot 10^{+44}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if y < -3.10000000000000015e59Initial program 90.0%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6475.8%
Simplified75.8%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6480.1%
Applied egg-rr80.1%
if -3.10000000000000015e59 < y < 1.3799999999999999e44Initial program 99.1%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6490.1%
Simplified90.1%
if 1.3799999999999999e44 < y Initial program 87.4%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6481.4%
Simplified81.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6491.3%
Applied egg-rr91.3%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ (- z x) t)))) (if (<= y -2e+59) t_1 (if (<= y 1.25e+44) (+ x (/ (* z y) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -2e+59) {
tmp = t_1;
} else if (y <= 1.25e+44) {
tmp = x + ((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 * ((z - x) / t)
if (y <= (-2d+59)) then
tmp = t_1
else if (y <= 1.25d+44) then
tmp = x + ((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 * ((z - x) / t);
double tmp;
if (y <= -2e+59) {
tmp = t_1;
} else if (y <= 1.25e+44) {
tmp = x + ((z * y) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -2e+59: tmp = t_1 elif y <= 1.25e+44: tmp = x + ((z * y) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -2e+59) tmp = t_1; elseif (y <= 1.25e+44) tmp = Float64(x + Float64(Float64(z * y) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -2e+59) tmp = t_1; elseif (y <= 1.25e+44) tmp = x + ((z * y) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+59], t$95$1, If[LessEqual[y, 1.25e+44], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -2 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+44}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.99999999999999994e59 or 1.2499999999999999e44 < y Initial program 88.6%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6479.0%
Simplified79.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.3%
Applied egg-rr86.3%
if -1.99999999999999994e59 < y < 1.2499999999999999e44Initial program 99.1%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f6490.1%
Simplified90.1%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ (- z x) t)))) (if (<= y -2.1e+59) t_1 (if (<= y 1.12e+44) (+ x (* y (/ z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -2.1e+59) {
tmp = t_1;
} else if (y <= 1.12e+44) {
tmp = x + (y * (z / 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 * ((z - x) / t)
if (y <= (-2.1d+59)) then
tmp = t_1
else if (y <= 1.12d+44) then
tmp = x + (y * (z / 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 * ((z - x) / t);
double tmp;
if (y <= -2.1e+59) {
tmp = t_1;
} else if (y <= 1.12e+44) {
tmp = x + (y * (z / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -2.1e+59: tmp = t_1 elif y <= 1.12e+44: tmp = x + (y * (z / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -2.1e+59) tmp = t_1; elseif (y <= 1.12e+44) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -2.1e+59) tmp = t_1; elseif (y <= 1.12e+44) tmp = x + (y * (z / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.1e+59], t$95$1, If[LessEqual[y, 1.12e+44], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -2.1 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+44}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.09999999999999984e59 or 1.12000000000000008e44 < y Initial program 88.6%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6479.0%
Simplified79.0%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.3%
Applied egg-rr86.3%
if -2.09999999999999984e59 < y < 1.12000000000000008e44Initial program 99.1%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6491.6%
Applied egg-rr91.6%
Taylor expanded in z around inf
Simplified88.1%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (/ (- z x) t)))) (if (<= y -3.8e-14) t_1 (if (<= y 6.2e-68) (* x (- 1.0 (/ y t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * ((z - x) / t);
double tmp;
if (y <= -3.8e-14) {
tmp = t_1;
} else if (y <= 6.2e-68) {
tmp = x * (1.0 - (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 * ((z - x) / t)
if (y <= (-3.8d-14)) then
tmp = t_1
else if (y <= 6.2d-68) then
tmp = x * (1.0d0 - (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 * ((z - x) / t);
double tmp;
if (y <= -3.8e-14) {
tmp = t_1;
} else if (y <= 6.2e-68) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * ((z - x) / t) tmp = 0 if y <= -3.8e-14: tmp = t_1 elif y <= 6.2e-68: tmp = x * (1.0 - (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(Float64(z - x) / t)) tmp = 0.0 if (y <= -3.8e-14) tmp = t_1; elseif (y <= 6.2e-68) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * ((z - x) / t); tmp = 0.0; if (y <= -3.8e-14) tmp = t_1; elseif (y <= 6.2e-68) tmp = x * (1.0 - (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e-14], t$95$1, If[LessEqual[y, 6.2e-68], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - x}{t}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.8000000000000002e-14 or 6.1999999999999999e-68 < y Initial program 91.5%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6474.4%
Simplified74.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6479.8%
Applied egg-rr79.8%
if -3.8000000000000002e-14 < y < 6.1999999999999999e-68Initial program 98.8%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6481.5%
Simplified81.5%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (if (<= z -3e+58) (* y (/ z t)) (if (<= z 1.35e+90) (* x (- 1.0 (/ y t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3e+58) {
tmp = y * (z / t);
} else if (z <= 1.35e+90) {
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 <= (-3d+58)) then
tmp = y * (z / t)
else if (z <= 1.35d+90) 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 <= -3e+58) {
tmp = y * (z / t);
} else if (z <= 1.35e+90) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3e+58: tmp = y * (z / t) elif z <= 1.35e+90: tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3e+58) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.35e+90) 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 <= -3e+58) tmp = y * (z / t); elseif (z <= 1.35e+90) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3e+58], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+90], 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 -3 \cdot 10^{+58}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+90}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -3.0000000000000002e58Initial program 83.1%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6464.9%
Simplified64.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6478.2%
Applied egg-rr78.2%
if -3.0000000000000002e58 < z < 1.35e90Initial program 97.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6479.0%
Simplified79.0%
if 1.35e90 < z Initial program 95.3%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6464.2%
Simplified64.2%
div-invN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
remove-double-divN/A
inv-powN/A
*-lowering-*.f64N/A
inv-powN/A
remove-double-divN/A
*-commutativeN/A
div-invN/A
/-lowering-/.f6466.5%
Applied egg-rr66.5%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ y t)))) (if (<= y -1.3e-15) t_1 (if (<= y 5.8e-68) x t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (y <= -1.3e-15) {
tmp = t_1;
} else if (y <= 5.8e-68) {
tmp = x;
} 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 = z * (y / t)
if (y <= (-1.3d-15)) then
tmp = t_1
else if (y <= 5.8d-68) then
tmp = x
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 = z * (y / t);
double tmp;
if (y <= -1.3e-15) {
tmp = t_1;
} else if (y <= 5.8e-68) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if y <= -1.3e-15: tmp = t_1 elif y <= 5.8e-68: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (y <= -1.3e-15) tmp = t_1; elseif (y <= 5.8e-68) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (y <= -1.3e-15) tmp = t_1; elseif (y <= 5.8e-68) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3e-15], t$95$1, If[LessEqual[y, 5.8e-68], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-68}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.30000000000000002e-15 or 5.8000000000000001e-68 < y Initial program 91.5%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f6449.1%
Simplified49.1%
div-invN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
remove-double-divN/A
inv-powN/A
*-lowering-*.f64N/A
inv-powN/A
remove-double-divN/A
*-commutativeN/A
div-invN/A
/-lowering-/.f6454.4%
Applied egg-rr54.4%
if -1.30000000000000002e-15 < y < 5.8000000000000001e-68Initial program 98.8%
Taylor expanded in y around 0
Simplified72.4%
(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 94.6%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6496.9%
Applied egg-rr96.9%
Final simplification96.9%
(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 94.6%
Taylor expanded in y around 0
Simplified42.3%
(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 2024138
(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)))