
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * 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 - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= t -3.45e+28) (+ x (fma -0.3333333333333333 (/ y z) (/ t (* 3.0 (* y z))))) (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.45e+28) {
tmp = x + fma(-0.3333333333333333, (y / z), (t / (3.0 * (y * z))));
} else {
tmp = x + (((t / y) - y) / (z * 3.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -3.45e+28) tmp = Float64(x + fma(-0.3333333333333333, Float64(y / z), Float64(t / Float64(3.0 * Float64(y * z))))); else tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.45e+28], N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + N[(t / N[(3.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.45 \cdot 10^{+28}:\\
\;\;\;\;x + \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, \frac{t}{3 \cdot \left(y \cdot z\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\end{array}
\end{array}
if t < -3.45e28Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
remove-double-neg99.8%
neg-mul-199.8%
*-lft-identity99.8%
metadata-eval99.8%
times-frac99.8%
neg-mul-199.8%
neg-mul-199.8%
distribute-rgt-neg-out99.8%
distribute-neg-frac99.8%
distribute-neg-out99.8%
neg-mul-199.8%
distribute-lft-out99.8%
neg-mul-199.8%
distribute-neg-out99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 99.9%
if -3.45e28 < t Initial program 93.1%
Simplified99.2%
frac-2neg99.2%
metadata-eval99.2%
clear-num99.2%
metadata-eval99.2%
frac-2neg99.2%
div-inv99.2%
metadata-eval99.2%
associate-*l/99.3%
*-un-lft-identity99.3%
Applied egg-rr99.3%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1e-22) (+ (/ t (* z (* y 3.0))) (- x (/ y (* z 3.0)))) (+ x (/ (- (/ t y) y) (* z 3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1e-22) {
tmp = (t / (z * (y * 3.0))) + (x - (y / (z * 3.0)));
} else {
tmp = x + (((t / y) - y) / (z * 3.0));
}
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 <= (-1d-22)) then
tmp = (t / (z * (y * 3.0d0))) + (x - (y / (z * 3.0d0)))
else
tmp = x + (((t / y) - y) / (z * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1e-22) {
tmp = (t / (z * (y * 3.0))) + (x - (y / (z * 3.0)));
} else {
tmp = x + (((t / y) - y) / (z * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1e-22: tmp = (t / (z * (y * 3.0))) + (x - (y / (z * 3.0))) else: tmp = x + (((t / y) - y) / (z * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1e-22) tmp = Float64(Float64(t / Float64(z * Float64(y * 3.0))) + Float64(x - Float64(y / Float64(z * 3.0)))); else tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1e-22) tmp = (t / (z * (y * 3.0))) + (x - (y / (z * 3.0))); else tmp = x + (((t / y) - y) / (z * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1e-22], N[(N[(t / N[(z * N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{-22}:\\
\;\;\;\;\frac{t}{z \cdot \left(y \cdot 3\right)} + \left(x - \frac{y}{z \cdot 3}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\end{array}
\end{array}
if t < -1e-22Initial program 99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
if -1e-22 < t Initial program 92.8%
Simplified99.2%
frac-2neg99.2%
metadata-eval99.2%
clear-num99.2%
metadata-eval99.2%
frac-2neg99.2%
div-inv99.2%
metadata-eval99.2%
associate-*l/99.3%
*-un-lft-identity99.3%
Applied egg-rr99.3%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -7.8e+40)
(+ x (/ (/ y -3.0) z))
(if (<= y 2.2e+31)
(+ x (* 0.3333333333333333 (/ t (* y z))))
(- x (/ y (* z 3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.8e+40) {
tmp = x + ((y / -3.0) / z);
} else if (y <= 2.2e+31) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x - (y / (z * 3.0));
}
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 <= (-7.8d+40)) then
tmp = x + ((y / (-3.0d0)) / z)
else if (y <= 2.2d+31) then
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
else
tmp = x - (y / (z * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.8e+40) {
tmp = x + ((y / -3.0) / z);
} else if (y <= 2.2e+31) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x - (y / (z * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.8e+40: tmp = x + ((y / -3.0) / z) elif y <= 2.2e+31: tmp = x + (0.3333333333333333 * (t / (y * z))) else: tmp = x - (y / (z * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.8e+40) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); elseif (y <= 2.2e+31) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x - Float64(y / Float64(z * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.8e+40) tmp = x + ((y / -3.0) / z); elseif (y <= 2.2e+31) tmp = x + (0.3333333333333333 * (t / (y * z))); else tmp = x - (y / (z * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.8e+40], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+31], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+40}:\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+31}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\end{array}
\end{array}
if y < -7.8000000000000002e40Initial program 97.5%
Simplified99.6%
Taylor expanded in z around 0 99.7%
*-commutative99.7%
metadata-eval99.7%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 95.3%
*-commutative95.3%
metadata-eval95.3%
times-frac95.3%
*-rgt-identity95.3%
*-commutative95.3%
associate-/r*95.4%
Simplified95.4%
if -7.8000000000000002e40 < y < 2.2000000000000001e31Initial program 91.7%
Simplified93.7%
Taylor expanded in t around inf 85.2%
if 2.2000000000000001e31 < y Initial program 99.8%
Simplified99.6%
Taylor expanded in t around 0 98.2%
*-commutative98.2%
associate-*l/98.2%
associate-*r/98.2%
Simplified98.2%
associate-*r/98.2%
associate-/l*98.3%
clear-num98.2%
add-sqr-sqrt59.4%
sqrt-unprod60.2%
frac-times60.3%
metadata-eval60.3%
metadata-eval60.3%
frac-times60.2%
sqrt-unprod6.7%
add-sqr-sqrt22.2%
clear-num22.2%
div-inv22.2%
metadata-eval22.2%
frac-2neg22.2%
distribute-rgt-neg-in22.2%
metadata-eval22.2%
metadata-eval22.2%
div-inv22.2%
clear-num22.2%
add-sqr-sqrt15.5%
sqrt-unprod49.6%
frac-times49.5%
metadata-eval49.5%
metadata-eval49.5%
frac-times49.6%
sqrt-unprod38.6%
add-sqr-sqrt98.2%
Applied egg-rr98.4%
Final simplification90.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -7e+46)
(+ x (/ (/ y -3.0) z))
(if (<= y 1.02e+32)
(+ x (* (/ t y) (/ 0.3333333333333333 z)))
(- x (/ y (* z 3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e+46) {
tmp = x + ((y / -3.0) / z);
} else if (y <= 1.02e+32) {
tmp = x + ((t / y) * (0.3333333333333333 / z));
} else {
tmp = x - (y / (z * 3.0));
}
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 <= (-7d+46)) then
tmp = x + ((y / (-3.0d0)) / z)
else if (y <= 1.02d+32) then
tmp = x + ((t / y) * (0.3333333333333333d0 / z))
else
tmp = x - (y / (z * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7e+46) {
tmp = x + ((y / -3.0) / z);
} else if (y <= 1.02e+32) {
tmp = x + ((t / y) * (0.3333333333333333 / z));
} else {
tmp = x - (y / (z * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7e+46: tmp = x + ((y / -3.0) / z) elif y <= 1.02e+32: tmp = x + ((t / y) * (0.3333333333333333 / z)) else: tmp = x - (y / (z * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7e+46) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); elseif (y <= 1.02e+32) tmp = Float64(x + Float64(Float64(t / y) * Float64(0.3333333333333333 / z))); else tmp = Float64(x - Float64(y / Float64(z * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7e+46) tmp = x + ((y / -3.0) / z); elseif (y <= 1.02e+32) tmp = x + ((t / y) * (0.3333333333333333 / z)); else tmp = x - (y / (z * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7e+46], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e+32], N[(x + N[(N[(t / y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+46}:\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+32}:\\
\;\;\;\;x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\end{array}
\end{array}
if y < -6.9999999999999997e46Initial program 97.5%
Simplified99.6%
Taylor expanded in z around 0 99.7%
*-commutative99.7%
metadata-eval99.7%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 95.3%
*-commutative95.3%
metadata-eval95.3%
times-frac95.3%
*-rgt-identity95.3%
*-commutative95.3%
associate-/r*95.4%
Simplified95.4%
if -6.9999999999999997e46 < y < 1.0199999999999999e32Initial program 91.7%
Simplified93.7%
Taylor expanded in t around inf 86.5%
if 1.0199999999999999e32 < y Initial program 99.8%
Simplified99.6%
Taylor expanded in t around 0 98.2%
*-commutative98.2%
associate-*l/98.2%
associate-*r/98.2%
Simplified98.2%
associate-*r/98.2%
associate-/l*98.3%
clear-num98.2%
add-sqr-sqrt59.4%
sqrt-unprod60.2%
frac-times60.3%
metadata-eval60.3%
metadata-eval60.3%
frac-times60.2%
sqrt-unprod6.7%
add-sqr-sqrt22.2%
clear-num22.2%
div-inv22.2%
metadata-eval22.2%
frac-2neg22.2%
distribute-rgt-neg-in22.2%
metadata-eval22.2%
metadata-eval22.2%
div-inv22.2%
clear-num22.2%
add-sqr-sqrt15.5%
sqrt-unprod49.6%
frac-times49.5%
metadata-eval49.5%
metadata-eval49.5%
frac-times49.6%
sqrt-unprod38.6%
add-sqr-sqrt98.2%
Applied egg-rr98.4%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (<= y -6e+43) (+ x (/ (/ y -3.0) z)) (if (<= y 1.22e+32) (+ x (/ (/ t y) (* z 3.0))) (- x (/ y (* z 3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6e+43) {
tmp = x + ((y / -3.0) / z);
} else if (y <= 1.22e+32) {
tmp = x + ((t / y) / (z * 3.0));
} else {
tmp = x - (y / (z * 3.0));
}
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 <= (-6d+43)) then
tmp = x + ((y / (-3.0d0)) / z)
else if (y <= 1.22d+32) then
tmp = x + ((t / y) / (z * 3.0d0))
else
tmp = x - (y / (z * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6e+43) {
tmp = x + ((y / -3.0) / z);
} else if (y <= 1.22e+32) {
tmp = x + ((t / y) / (z * 3.0));
} else {
tmp = x - (y / (z * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6e+43: tmp = x + ((y / -3.0) / z) elif y <= 1.22e+32: tmp = x + ((t / y) / (z * 3.0)) else: tmp = x - (y / (z * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6e+43) tmp = Float64(x + Float64(Float64(y / -3.0) / z)); elseif (y <= 1.22e+32) tmp = Float64(x + Float64(Float64(t / y) / Float64(z * 3.0))); else tmp = Float64(x - Float64(y / Float64(z * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6e+43) tmp = x + ((y / -3.0) / z); elseif (y <= 1.22e+32) tmp = x + ((t / y) / (z * 3.0)); else tmp = x - (y / (z * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6e+43], N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.22e+32], N[(x + N[(N[(t / y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+43}:\\
\;\;\;\;x + \frac{\frac{y}{-3}}{z}\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{+32}:\\
\;\;\;\;x + \frac{\frac{t}{y}}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z \cdot 3}\\
\end{array}
\end{array}
if y < -6.00000000000000033e43Initial program 97.5%
Simplified99.6%
Taylor expanded in z around 0 99.7%
*-commutative99.7%
metadata-eval99.7%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 95.3%
*-commutative95.3%
metadata-eval95.3%
times-frac95.3%
*-rgt-identity95.3%
*-commutative95.3%
associate-/r*95.4%
Simplified95.4%
if -6.00000000000000033e43 < y < 1.22000000000000002e32Initial program 91.7%
Simplified93.7%
Taylor expanded in t around inf 85.2%
associate-/r*86.5%
associate-*r/86.5%
associate-*l/86.5%
associate-*r/91.4%
associate-*l/83.7%
*-commutative83.7%
Simplified83.7%
associate-*r/91.4%
*-un-lft-identity91.4%
times-frac83.7%
div-inv83.7%
metadata-eval83.7%
associate-/r*83.6%
*-commutative83.6%
associate-*l/83.7%
*-un-lft-identity83.7%
times-frac86.5%
div-inv86.5%
*-un-lft-identity86.5%
Applied egg-rr86.5%
if 1.22000000000000002e32 < y Initial program 99.8%
Simplified99.6%
Taylor expanded in t around 0 98.2%
*-commutative98.2%
associate-*l/98.2%
associate-*r/98.2%
Simplified98.2%
associate-*r/98.2%
associate-/l*98.3%
clear-num98.2%
add-sqr-sqrt59.4%
sqrt-unprod60.2%
frac-times60.3%
metadata-eval60.3%
metadata-eval60.3%
frac-times60.2%
sqrt-unprod6.7%
add-sqr-sqrt22.2%
clear-num22.2%
div-inv22.2%
metadata-eval22.2%
frac-2neg22.2%
distribute-rgt-neg-in22.2%
metadata-eval22.2%
metadata-eval22.2%
div-inv22.2%
clear-num22.2%
add-sqr-sqrt15.5%
sqrt-unprod49.6%
frac-times49.5%
metadata-eval49.5%
metadata-eval49.5%
frac-times49.6%
sqrt-unprod38.6%
add-sqr-sqrt98.2%
Applied egg-rr98.4%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (+ x (* 0.3333333333333333 (/ (- (/ t y) y) z))))
double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 * (((t / y) - y) / z));
}
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 + (0.3333333333333333d0 * (((t / y) - y) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 * (((t / y) - y) / z));
}
def code(x, y, z, t): return x + (0.3333333333333333 * (((t / y) - y) / z))
function code(x, y, z, t) return Float64(x + Float64(0.3333333333333333 * Float64(Float64(Float64(t / y) - y) / z))) end
function tmp = code(x, y, z, t) tmp = x + (0.3333333333333333 * (((t / y) - y) / z)); end
code[x_, y_, z_, t_] := N[(x + N[(0.3333333333333333 * N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 0.3333333333333333 \cdot \frac{\frac{t}{y} - y}{z}
\end{array}
Initial program 94.7%
Simplified96.2%
Taylor expanded in z around 0 96.1%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (+ x (* (- (/ t y) y) (/ 0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + (((t / y) - y) * (0.3333333333333333 / z));
}
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 + (((t / y) - y) * (0.3333333333333333d0 / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (((t / y) - y) * (0.3333333333333333 / z));
}
def code(x, y, z, t): return x + (((t / y) - y) * (0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(t / y) - y) * Float64(0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + (((t / y) - y) * (0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\frac{t}{y} - y\right) \cdot \frac{0.3333333333333333}{z}
\end{array}
Initial program 94.7%
Simplified96.2%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (+ x (/ 0.3333333333333333 (/ z (- (/ t y) y)))))
double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 / (z / ((t / y) - 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 + (0.3333333333333333d0 / (z / ((t / y) - y)))
end function
public static double code(double x, double y, double z, double t) {
return x + (0.3333333333333333 / (z / ((t / y) - y)));
}
def code(x, y, z, t): return x + (0.3333333333333333 / (z / ((t / y) - y)))
function code(x, y, z, t) return Float64(x + Float64(0.3333333333333333 / Float64(z / Float64(Float64(t / y) - y)))) end
function tmp = code(x, y, z, t) tmp = x + (0.3333333333333333 / (z / ((t / y) - y))); end
code[x_, y_, z_, t_] := N[(x + N[(0.3333333333333333 / N[(z / N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{0.3333333333333333}{\frac{z}{\frac{t}{y} - y}}
\end{array}
Initial program 94.7%
Simplified96.2%
associate-*l/96.1%
associate-/l*96.2%
Applied egg-rr96.2%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (+ x (/ (- (/ t y) y) (* z 3.0))))
double code(double x, double y, double z, double t) {
return x + (((t / y) - y) / (z * 3.0));
}
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 + (((t / y) - y) / (z * 3.0d0))
end function
public static double code(double x, double y, double z, double t) {
return x + (((t / y) - y) / (z * 3.0));
}
def code(x, y, z, t): return x + (((t / y) - y) / (z * 3.0))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))) end
function tmp = code(x, y, z, t) tmp = x + (((t / y) - y) / (z * 3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{t}{y} - y}{z \cdot 3}
\end{array}
Initial program 94.7%
Simplified96.2%
frac-2neg96.2%
metadata-eval96.2%
clear-num96.1%
metadata-eval96.1%
frac-2neg96.1%
div-inv96.2%
metadata-eval96.2%
associate-*l/96.2%
*-un-lft-identity96.2%
Applied egg-rr96.2%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (+ x (* y (/ -0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + (y * (-0.3333333333333333 / z));
}
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 * ((-0.3333333333333333d0) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + (y * (-0.3333333333333333 / z));
}
def code(x, y, z, t): return x + (y * (-0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(y * Float64(-0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + (y * (-0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 94.7%
Simplified96.2%
Taylor expanded in t around 0 64.9%
*-commutative64.9%
associate-*l/64.9%
associate-*r/64.9%
Simplified64.9%
Final simplification64.9%
(FPCore (x y z t) :precision binary64 (+ x (/ -0.3333333333333333 (/ z y))))
double code(double x, double y, double z, double t) {
return x + (-0.3333333333333333 / (z / 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 + ((-0.3333333333333333d0) / (z / y))
end function
public static double code(double x, double y, double z, double t) {
return x + (-0.3333333333333333 / (z / y));
}
def code(x, y, z, t): return x + (-0.3333333333333333 / (z / y))
function code(x, y, z, t) return Float64(x + Float64(-0.3333333333333333 / Float64(z / y))) end
function tmp = code(x, y, z, t) tmp = x + (-0.3333333333333333 / (z / y)); end
code[x_, y_, z_, t_] := N[(x + N[(-0.3333333333333333 / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-0.3333333333333333}{\frac{z}{y}}
\end{array}
Initial program 94.7%
Simplified96.2%
frac-2neg96.2%
metadata-eval96.2%
clear-num96.1%
metadata-eval96.1%
frac-2neg96.1%
div-inv96.2%
metadata-eval96.2%
associate-*l/96.2%
*-un-lft-identity96.2%
Applied egg-rr96.2%
Taylor expanded in t around 0 64.9%
associate-*r/64.9%
associate-/l*65.0%
Simplified65.0%
Final simplification65.0%
(FPCore (x y z t) :precision binary64 (+ x (/ (/ y -3.0) z)))
double code(double x, double y, double z, double t) {
return x + ((y / -3.0) / z);
}
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 / (-3.0d0)) / z)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / -3.0) / z);
}
def code(x, y, z, t): return x + ((y / -3.0) / z)
function code(x, y, z, t) return Float64(x + Float64(Float64(y / -3.0) / z)) end
function tmp = code(x, y, z, t) tmp = x + ((y / -3.0) / z); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / -3.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{y}{-3}}{z}
\end{array}
Initial program 94.7%
Simplified96.2%
Taylor expanded in z around 0 96.1%
*-commutative96.1%
metadata-eval96.1%
div-inv96.2%
Applied egg-rr96.2%
Taylor expanded in t around 0 64.9%
*-commutative64.9%
metadata-eval64.9%
times-frac65.0%
*-rgt-identity65.0%
*-commutative65.0%
associate-/r*65.0%
Simplified65.0%
Final simplification65.0%
(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.7%
associate-*l*94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in x around inf 31.7%
Final simplification31.7%
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / 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 - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}
\end{array}
herbie shell --seed 2024013
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))