
(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 15 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 1.06e-50) (+ x (/ 1.0 (* (/ 3.0 (- (/ t y) y)) z))) (+ (- x (/ y (* 3.0 z))) (/ t (* y (* 3.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.06e-50) {
tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z));
} else {
tmp = (x - (y / (3.0 * z))) + (t / (y * (3.0 * z)));
}
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 <= 1.06d-50) then
tmp = x + (1.0d0 / ((3.0d0 / ((t / y) - y)) * z))
else
tmp = (x - (y / (3.0d0 * z))) + (t / (y * (3.0d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.06e-50) {
tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z));
} else {
tmp = (x - (y / (3.0 * z))) + (t / (y * (3.0 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.06e-50: tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z)) else: tmp = (x - (y / (3.0 * z))) + (t / (y * (3.0 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.06e-50) tmp = Float64(x + Float64(1.0 / Float64(Float64(3.0 / Float64(Float64(t / y) - y)) * z))); else tmp = Float64(Float64(x - Float64(y / Float64(3.0 * z))) + Float64(t / Float64(y * Float64(3.0 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.06e-50) tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z)); else tmp = (x - (y / (3.0 * z))) + (t / (y * (3.0 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.06e-50], N[(x + N[(1.0 / N[(N[(3.0 / N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.06 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{1}{\frac{3}{\frac{t}{y} - y} \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{3 \cdot z}\right) + \frac{t}{y \cdot \left(3 \cdot z\right)}\\
\end{array}
\end{array}
if t < 1.05999999999999995e-50Initial program 90.9%
Simplified97.3%
associate-*l/97.3%
clear-num97.3%
Applied egg-rr97.3%
clear-num97.3%
associate-/r/97.2%
associate-/r*97.3%
metadata-eval97.3%
Applied egg-rr97.3%
if 1.05999999999999995e-50 < t Initial program 99.8%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (<= t 1.3e-50) (+ x (/ 1.0 (* (/ 3.0 (- (/ t y) y)) z))) (+ (- x (/ y (* 3.0 z))) (/ t (* z (* 3.0 y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e-50) {
tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z));
} else {
tmp = (x - (y / (3.0 * z))) + (t / (z * (3.0 * 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 (t <= 1.3d-50) then
tmp = x + (1.0d0 / ((3.0d0 / ((t / y) - y)) * z))
else
tmp = (x - (y / (3.0d0 * z))) + (t / (z * (3.0d0 * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e-50) {
tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z));
} else {
tmp = (x - (y / (3.0 * z))) + (t / (z * (3.0 * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.3e-50: tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z)) else: tmp = (x - (y / (3.0 * z))) + (t / (z * (3.0 * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.3e-50) tmp = Float64(x + Float64(1.0 / Float64(Float64(3.0 / Float64(Float64(t / y) - y)) * z))); else tmp = Float64(Float64(x - Float64(y / Float64(3.0 * z))) + Float64(t / Float64(z * Float64(3.0 * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.3e-50) tmp = x + (1.0 / ((3.0 / ((t / y) - y)) * z)); else tmp = (x - (y / (3.0 * z))) + (t / (z * (3.0 * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.3e-50], N[(x + N[(1.0 / N[(N[(3.0 / N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{1}{\frac{3}{\frac{t}{y} - y} \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{3 \cdot z}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\
\end{array}
\end{array}
if t < 1.3000000000000001e-50Initial program 90.9%
Simplified97.3%
associate-*l/97.3%
clear-num97.3%
Applied egg-rr97.3%
clear-num97.3%
associate-/r/97.2%
associate-/r*97.3%
metadata-eval97.3%
Applied egg-rr97.3%
if 1.3000000000000001e-50 < t Initial program 99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification97.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.22e+67)
(- x (/ y (* 3.0 z)))
(if (<= y 1e+18)
(+ x (* 0.3333333333333333 (/ t (* y z))))
(- x (/ (* y 0.3333333333333333) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+67) {
tmp = x - (y / (3.0 * z));
} else if (y <= 1e+18) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x - ((y * 0.3333333333333333) / z);
}
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.22d+67)) then
tmp = x - (y / (3.0d0 * z))
else if (y <= 1d+18) then
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
else
tmp = x - ((y * 0.3333333333333333d0) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+67) {
tmp = x - (y / (3.0 * z));
} else if (y <= 1e+18) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x - ((y * 0.3333333333333333) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.22e+67: tmp = x - (y / (3.0 * z)) elif y <= 1e+18: tmp = x + (0.3333333333333333 * (t / (y * z))) else: tmp = x - ((y * 0.3333333333333333) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.22e+67) tmp = Float64(x - Float64(y / Float64(3.0 * z))); elseif (y <= 1e+18) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x - Float64(Float64(y * 0.3333333333333333) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.22e+67) tmp = x - (y / (3.0 * z)); elseif (y <= 1e+18) tmp = x + (0.3333333333333333 * (t / (y * z))); else tmp = x - ((y * 0.3333333333333333) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.22e+67], N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+18], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+67}:\\
\;\;\;\;x - \frac{y}{3 \cdot z}\\
\mathbf{elif}\;y \leq 10^{+18}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot 0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -1.22000000000000004e67Initial program 99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 96.8%
metadata-eval96.8%
times-frac96.9%
*-un-lft-identity96.9%
*-commutative96.9%
Applied egg-rr96.9%
if -1.22000000000000004e67 < y < 1e18Initial program 88.1%
Simplified92.7%
Taylor expanded in t around inf 82.9%
if 1e18 < y Initial program 98.3%
associate-*l*98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in y around inf 92.9%
metadata-eval92.9%
cancel-sign-sub-inv92.9%
associate-*r/93.0%
Simplified93.0%
Final simplification88.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.26e+67)
(- x (/ y (* 3.0 z)))
(if (<= y 7.6e+18)
(+ x (* 0.3333333333333333 (/ (/ t z) y)))
(- x (/ (* y 0.3333333333333333) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.26e+67) {
tmp = x - (y / (3.0 * z));
} else if (y <= 7.6e+18) {
tmp = x + (0.3333333333333333 * ((t / z) / y));
} else {
tmp = x - ((y * 0.3333333333333333) / z);
}
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.26d+67)) then
tmp = x - (y / (3.0d0 * z))
else if (y <= 7.6d+18) then
tmp = x + (0.3333333333333333d0 * ((t / z) / y))
else
tmp = x - ((y * 0.3333333333333333d0) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.26e+67) {
tmp = x - (y / (3.0 * z));
} else if (y <= 7.6e+18) {
tmp = x + (0.3333333333333333 * ((t / z) / y));
} else {
tmp = x - ((y * 0.3333333333333333) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.26e+67: tmp = x - (y / (3.0 * z)) elif y <= 7.6e+18: tmp = x + (0.3333333333333333 * ((t / z) / y)) else: tmp = x - ((y * 0.3333333333333333) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.26e+67) tmp = Float64(x - Float64(y / Float64(3.0 * z))); elseif (y <= 7.6e+18) tmp = Float64(x + Float64(0.3333333333333333 * Float64(Float64(t / z) / y))); else tmp = Float64(x - Float64(Float64(y * 0.3333333333333333) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.26e+67) tmp = x - (y / (3.0 * z)); elseif (y <= 7.6e+18) tmp = x + (0.3333333333333333 * ((t / z) / y)); else tmp = x - ((y * 0.3333333333333333) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.26e+67], N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.6e+18], N[(x + N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.26 \cdot 10^{+67}:\\
\;\;\;\;x - \frac{y}{3 \cdot z}\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+18}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot 0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -1.26e67Initial program 99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 96.8%
metadata-eval96.8%
times-frac96.9%
*-un-lft-identity96.9%
*-commutative96.9%
Applied egg-rr96.9%
if -1.26e67 < y < 7.6e18Initial program 88.1%
Simplified92.7%
Taylor expanded in t around inf 82.9%
associate-/r*84.9%
*-lft-identity84.9%
associate-*l/84.8%
associate-*r/89.6%
associate-*l/89.7%
associate-*r/89.7%
*-lft-identity89.7%
Simplified89.7%
if 7.6e18 < y Initial program 98.3%
associate-*l*98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in y around inf 92.9%
metadata-eval92.9%
cancel-sign-sub-inv92.9%
associate-*r/93.0%
Simplified93.0%
Final simplification92.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.22e+67)
(- x (/ y (* 3.0 z)))
(if (<= y 6e+18)
(+ x (/ (* 0.3333333333333333 (/ t z)) y))
(- x (/ (* y 0.3333333333333333) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+67) {
tmp = x - (y / (3.0 * z));
} else if (y <= 6e+18) {
tmp = x + ((0.3333333333333333 * (t / z)) / y);
} else {
tmp = x - ((y * 0.3333333333333333) / z);
}
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.22d+67)) then
tmp = x - (y / (3.0d0 * z))
else if (y <= 6d+18) then
tmp = x + ((0.3333333333333333d0 * (t / z)) / y)
else
tmp = x - ((y * 0.3333333333333333d0) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.22e+67) {
tmp = x - (y / (3.0 * z));
} else if (y <= 6e+18) {
tmp = x + ((0.3333333333333333 * (t / z)) / y);
} else {
tmp = x - ((y * 0.3333333333333333) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.22e+67: tmp = x - (y / (3.0 * z)) elif y <= 6e+18: tmp = x + ((0.3333333333333333 * (t / z)) / y) else: tmp = x - ((y * 0.3333333333333333) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.22e+67) tmp = Float64(x - Float64(y / Float64(3.0 * z))); elseif (y <= 6e+18) tmp = Float64(x + Float64(Float64(0.3333333333333333 * Float64(t / z)) / y)); else tmp = Float64(x - Float64(Float64(y * 0.3333333333333333) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.22e+67) tmp = x - (y / (3.0 * z)); elseif (y <= 6e+18) tmp = x + ((0.3333333333333333 * (t / z)) / y); else tmp = x - ((y * 0.3333333333333333) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.22e+67], N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+18], N[(x + N[(N[(0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * 0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.22 \cdot 10^{+67}:\\
\;\;\;\;x - \frac{y}{3 \cdot z}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+18}:\\
\;\;\;\;x + \frac{0.3333333333333333 \cdot \frac{t}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot 0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -1.22000000000000004e67Initial program 99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around 0 96.8%
metadata-eval96.8%
times-frac96.9%
*-un-lft-identity96.9%
*-commutative96.9%
Applied egg-rr96.9%
if -1.22000000000000004e67 < y < 6e18Initial program 88.1%
Simplified92.7%
Taylor expanded in t around inf 82.9%
associate-/r*84.9%
*-lft-identity84.9%
associate-*l/84.8%
associate-*r/89.6%
associate-*l/89.7%
associate-*r/89.7%
*-lft-identity89.7%
Simplified89.7%
associate-*r/89.8%
Applied egg-rr89.8%
if 6e18 < y Initial program 98.3%
associate-*l*98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in y around inf 92.9%
metadata-eval92.9%
cancel-sign-sub-inv92.9%
associate-*r/93.0%
Simplified93.0%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (if (<= z -4.8e+86) x (if (<= z 9.3e+27) (* (/ y z) -0.3333333333333333) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.8e+86) {
tmp = x;
} else if (z <= 9.3e+27) {
tmp = (y / z) * -0.3333333333333333;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4.8d+86)) then
tmp = x
else if (z <= 9.3d+27) then
tmp = (y / z) * (-0.3333333333333333d0)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.8e+86) {
tmp = x;
} else if (z <= 9.3e+27) {
tmp = (y / z) * -0.3333333333333333;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.8e+86: tmp = x elif z <= 9.3e+27: tmp = (y / z) * -0.3333333333333333 else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.8e+86) tmp = x; elseif (z <= 9.3e+27) tmp = Float64(Float64(y / z) * -0.3333333333333333); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.8e+86) tmp = x; elseif (z <= 9.3e+27) tmp = (y / z) * -0.3333333333333333; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.8e+86], x, If[LessEqual[z, 9.3e+27], N[(N[(y / z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+86}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9.3 \cdot 10^{+27}:\\
\;\;\;\;\frac{y}{z} \cdot -0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.8000000000000001e86 or 9.30000000000000043e27 < z Initial program 98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 53.0%
if -4.8000000000000001e86 < z < 9.30000000000000043e27Initial program 89.5%
associate-*l*89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in t around 0 54.1%
Taylor expanded in x around 0 47.8%
Final simplification49.8%
(FPCore (x y z t) :precision binary64 (if (<= z -4e+85) x (if (<= z 4.7e+27) (/ -0.3333333333333333 (/ z y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+85) {
tmp = x;
} else if (z <= 4.7e+27) {
tmp = -0.3333333333333333 / (z / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4d+85)) then
tmp = x
else if (z <= 4.7d+27) then
tmp = (-0.3333333333333333d0) / (z / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+85) {
tmp = x;
} else if (z <= 4.7e+27) {
tmp = -0.3333333333333333 / (z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+85: tmp = x elif z <= 4.7e+27: tmp = -0.3333333333333333 / (z / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+85) tmp = x; elseif (z <= 4.7e+27) tmp = Float64(-0.3333333333333333 / Float64(z / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e+85) tmp = x; elseif (z <= 4.7e+27) tmp = -0.3333333333333333 / (z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+85], x, If[LessEqual[z, 4.7e+27], N[(-0.3333333333333333 / N[(z / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+85}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+27}:\\
\;\;\;\;\frac{-0.3333333333333333}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.0000000000000001e85 or 4.69999999999999976e27 < z Initial program 98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 53.0%
if -4.0000000000000001e85 < z < 4.69999999999999976e27Initial program 89.5%
associate-*l*89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in t around 0 54.1%
Taylor expanded in x around 0 47.8%
clear-num47.8%
un-div-inv47.8%
Applied egg-rr47.8%
Final simplification49.8%
(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 93.2%
Simplified96.0%
Taylor expanded in z around 0 96.0%
Final simplification96.0%
(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 93.2%
Simplified96.0%
associate-*l/96.0%
associate-/l*96.0%
Applied egg-rr96.0%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (+ x (/ (- (/ t y) y) (* 3.0 z))))
double code(double x, double y, double z, double t) {
return x + (((t / y) - 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 + (((t / y) - y) / (3.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return x + (((t / y) - y) / (3.0 * z));
}
def code(x, y, z, t): return x + (((t / y) - y) / (3.0 * z))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(3.0 * z))) end
function tmp = code(x, y, z, t) tmp = x + (((t / y) - y) / (3.0 * z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{t}{y} - y}{3 \cdot z}
\end{array}
Initial program 93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
associate-+l-93.2%
*-commutative93.2%
associate-*l*93.2%
associate-/l/96.1%
sub-div96.0%
Applied egg-rr96.0%
Final simplification96.0%
(FPCore (x y z t) :precision binary64 (- x (* 0.3333333333333333 (/ y z))))
double code(double x, double y, double z, double t) {
return x - (0.3333333333333333 * (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 * (y / z))
end function
public static double code(double x, double y, double z, double t) {
return x - (0.3333333333333333 * (y / z));
}
def code(x, y, z, t): return x - (0.3333333333333333 * (y / z))
function code(x, y, z, t) return Float64(x - Float64(0.3333333333333333 * Float64(y / z))) end
function tmp = code(x, y, z, t) tmp = x - (0.3333333333333333 * (y / z)); end
code[x_, y_, z_, t_] := N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - 0.3333333333333333 \cdot \frac{y}{z}
\end{array}
Initial program 93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 61.8%
Final simplification61.8%
(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 93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in y around inf 61.8%
metadata-eval61.8%
cancel-sign-sub-inv61.8%
associate-*r/61.8%
Simplified61.8%
associate-/l*61.8%
associate-/r/61.8%
Applied egg-rr61.8%
Final simplification61.8%
(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 93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 61.8%
clear-num61.8%
un-div-inv61.8%
Applied egg-rr61.8%
Final simplification61.8%
(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(y / Float64(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[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{3 \cdot z}
\end{array}
Initial program 93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 61.8%
metadata-eval61.8%
times-frac61.8%
*-un-lft-identity61.8%
*-commutative61.8%
Applied egg-rr61.8%
Final simplification61.8%
(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 93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in x around inf 25.9%
Final simplification25.9%
(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 2024031
(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))))