
(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 11 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 (<= y -1.08e-88)
(+ x (/ (- (/ t y) y) (* z 3.0)))
(if (<= y 2.35e-167)
(+ x (/ 1.0 (/ y (* (/ t z) 0.3333333333333333))))
(+ x (/ (* -0.3333333333333333 (- y (/ t y))) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.08e-88) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else if (y <= 2.35e-167) {
tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333)));
} else {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / 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.08d-88)) then
tmp = x + (((t / y) - y) / (z * 3.0d0))
else if (y <= 2.35d-167) then
tmp = x + (1.0d0 / (y / ((t / z) * 0.3333333333333333d0)))
else
tmp = x + (((-0.3333333333333333d0) * (y - (t / y))) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.08e-88) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else if (y <= 2.35e-167) {
tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333)));
} else {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.08e-88: tmp = x + (((t / y) - y) / (z * 3.0)) elif y <= 2.35e-167: tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333))) else: tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.08e-88) tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); elseif (y <= 2.35e-167) tmp = Float64(x + Float64(1.0 / Float64(y / Float64(Float64(t / z) * 0.3333333333333333)))); else tmp = Float64(x + Float64(Float64(-0.3333333333333333 * Float64(y - Float64(t / y))) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.08e-88) tmp = x + (((t / y) - y) / (z * 3.0)); elseif (y <= 2.35e-167) tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333))); else tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.08e-88], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.35e-167], N[(x + N[(1.0 / N[(y / N[(N[(t / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-0.3333333333333333 * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{-88}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-167}:\\
\;\;\;\;x + \frac{1}{\frac{y}{\frac{t}{z} \cdot 0.3333333333333333}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot \left(y - \frac{t}{y}\right)}{z}\\
\end{array}
\end{array}
if y < -1.07999999999999995e-88Initial program 97.3%
associate-+l-97.3%
*-commutative97.3%
Simplified97.3%
sub-neg97.3%
*-commutative97.3%
associate-*r*97.2%
*-commutative97.2%
associate-/r*96.3%
Applied egg-rr96.3%
unsub-neg96.3%
associate-/r*96.2%
associate-/r*96.2%
associate-/l/97.2%
div-sub97.2%
associate-/r*98.5%
div-sub99.8%
associate-/r*99.8%
Simplified99.8%
if -1.07999999999999995e-88 < y < 2.34999999999999985e-167Initial program 90.0%
Simplified86.8%
Taylor expanded in y around 0 89.7%
associate-*r/89.7%
metadata-eval89.7%
distribute-lft-neg-in89.7%
distribute-frac-neg89.7%
associate-*r/89.7%
associate-/l/98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*r/98.5%
associate-*r/98.4%
associate-/l*98.3%
associate-*l/98.3%
associate-*r/98.3%
associate-/r*98.3%
associate-*r/98.4%
metadata-eval98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
associate-*r/89.7%
Simplified89.7%
clear-num89.7%
inv-pow89.7%
associate-/l*98.4%
associate-/l/98.5%
Applied egg-rr98.5%
unpow-198.5%
Simplified98.5%
if 2.34999999999999985e-167 < y Initial program 93.5%
Simplified99.7%
associate-*l/99.7%
Applied egg-rr99.7%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (+ x (- (* (* -0.3333333333333333 (/ t z)) (/ -1.0 y)) (/ y (* z 3.0)))))
double code(double x, double y, double z, double t) {
return x + (((-0.3333333333333333 * (t / z)) * (-1.0 / 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 + ((((-0.3333333333333333d0) * (t / z)) * ((-1.0d0) / y)) - (y / (z * 3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + (((-0.3333333333333333 * (t / z)) * (-1.0 / y)) - (y / (z * 3.0)));
}
def code(x, y, z, t): return x + (((-0.3333333333333333 * (t / z)) * (-1.0 / y)) - (y / (z * 3.0)))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(-0.3333333333333333 * Float64(t / z)) * Float64(-1.0 / y)) - Float64(y / Float64(z * 3.0)))) end
function tmp = code(x, y, z, t) tmp = x + (((-0.3333333333333333 * (t / z)) * (-1.0 / y)) - (y / (z * 3.0))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(-0.3333333333333333 * N[(t / z), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(-0.3333333333333333 \cdot \frac{t}{z}\right) \cdot \frac{-1}{y} - \frac{y}{z \cdot 3}\right)
\end{array}
Initial program 93.5%
associate-+l-93.5%
sub-neg93.5%
distribute-frac-neg93.5%
associate-/r*97.2%
neg-mul-197.2%
*-commutative97.2%
times-frac97.1%
metadata-eval97.1%
Simplified97.1%
div-inv97.1%
Applied egg-rr97.1%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.4e-87) (not (<= y 1.6e-158))) (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))) (+ x (* 0.3333333333333333 (/ (/ t z) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.4e-87) || !(y <= 1.6e-158)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + (0.3333333333333333 * ((t / z) / 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 ((y <= (-1.4d-87)) .or. (.not. (y <= 1.6d-158))) then
tmp = x + ((y - (t / y)) * ((-0.3333333333333333d0) / z))
else
tmp = x + (0.3333333333333333d0 * ((t / z) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.4e-87) || !(y <= 1.6e-158)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + (0.3333333333333333 * ((t / z) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.4e-87) or not (y <= 1.6e-158): tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)) else: tmp = x + (0.3333333333333333 * ((t / z) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.4e-87) || !(y <= 1.6e-158)) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))); else tmp = Float64(x + Float64(0.3333333333333333 * Float64(Float64(t / z) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.4e-87) || ~((y <= 1.6e-158))) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); else tmp = x + (0.3333333333333333 * ((t / z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.4e-87], N[Not[LessEqual[y, 1.6e-158]], $MachinePrecision]], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-87} \lor \neg \left(y \leq 1.6 \cdot 10^{-158}\right):\\
\;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\
\end{array}
\end{array}
if y < -1.4e-87 or 1.59999999999999998e-158 < y Initial program 95.1%
Simplified99.7%
if -1.4e-87 < y < 1.59999999999999998e-158Initial program 90.0%
Simplified86.8%
Taylor expanded in y around 0 89.7%
associate-*r/89.7%
metadata-eval89.7%
distribute-lft-neg-in89.7%
distribute-frac-neg89.7%
associate-*r/89.7%
associate-/l/98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*r/98.5%
associate-*r/98.4%
associate-/l*98.3%
associate-*l/98.3%
associate-*r/98.3%
associate-/r*98.3%
associate-*r/98.4%
metadata-eval98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
associate-*r/89.7%
Simplified89.7%
clear-num89.7%
associate-/r/89.6%
clear-num89.7%
*-commutative89.7%
associate-/r*98.4%
Applied egg-rr98.4%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.1e-86) (not (<= y 1.5e-158))) (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))) (+ x (/ 1.0 (/ y (* (/ t z) 0.3333333333333333))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e-86) || !(y <= 1.5e-158)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333)));
}
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 <= (-2.1d-86)) .or. (.not. (y <= 1.5d-158))) then
tmp = x + ((y - (t / y)) * ((-0.3333333333333333d0) / z))
else
tmp = x + (1.0d0 / (y / ((t / z) * 0.3333333333333333d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e-86) || !(y <= 1.5e-158)) {
tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z));
} else {
tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.1e-86) or not (y <= 1.5e-158): tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)) else: tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.1e-86) || !(y <= 1.5e-158)) tmp = Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))); else tmp = Float64(x + Float64(1.0 / Float64(y / Float64(Float64(t / z) * 0.3333333333333333)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.1e-86) || ~((y <= 1.5e-158))) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); else tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.1e-86], N[Not[LessEqual[y, 1.5e-158]], $MachinePrecision]], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / N[(y / N[(N[(t / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-86} \lor \neg \left(y \leq 1.5 \cdot 10^{-158}\right):\\
\;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{y}{\frac{t}{z} \cdot 0.3333333333333333}}\\
\end{array}
\end{array}
if y < -2.1e-86 or 1.5e-158 < y Initial program 95.1%
Simplified99.7%
if -2.1e-86 < y < 1.5e-158Initial program 90.0%
Simplified86.8%
Taylor expanded in y around 0 89.7%
associate-*r/89.7%
metadata-eval89.7%
distribute-lft-neg-in89.7%
distribute-frac-neg89.7%
associate-*r/89.7%
associate-/l/98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*r/98.5%
associate-*r/98.4%
associate-/l*98.3%
associate-*l/98.3%
associate-*r/98.3%
associate-/r*98.3%
associate-*r/98.4%
metadata-eval98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
associate-*r/89.7%
Simplified89.7%
clear-num89.7%
inv-pow89.7%
associate-/l*98.4%
associate-/l/98.5%
Applied egg-rr98.5%
unpow-198.5%
Simplified98.5%
Final simplification99.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (/ t y))))
(if (<= y -3.8e-88)
(+ x (* t_1 (/ -0.3333333333333333 z)))
(if (<= y 1.1e-158)
(+ x (/ 1.0 (/ y (* (/ t z) 0.3333333333333333))))
(+ x (/ (* -0.3333333333333333 t_1) z))))))
double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -3.8e-88) {
tmp = x + (t_1 * (-0.3333333333333333 / z));
} else if (y <= 1.1e-158) {
tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333)));
} else {
tmp = x + ((-0.3333333333333333 * t_1) / 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) :: t_1
real(8) :: tmp
t_1 = y - (t / y)
if (y <= (-3.8d-88)) then
tmp = x + (t_1 * ((-0.3333333333333333d0) / z))
else if (y <= 1.1d-158) then
tmp = x + (1.0d0 / (y / ((t / z) * 0.3333333333333333d0)))
else
tmp = x + (((-0.3333333333333333d0) * t_1) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -3.8e-88) {
tmp = x + (t_1 * (-0.3333333333333333 / z));
} else if (y <= 1.1e-158) {
tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333)));
} else {
tmp = x + ((-0.3333333333333333 * t_1) / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = y - (t / y) tmp = 0 if y <= -3.8e-88: tmp = x + (t_1 * (-0.3333333333333333 / z)) elif y <= 1.1e-158: tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333))) else: tmp = x + ((-0.3333333333333333 * t_1) / z) return tmp
function code(x, y, z, t) t_1 = Float64(y - Float64(t / y)) tmp = 0.0 if (y <= -3.8e-88) tmp = Float64(x + Float64(t_1 * Float64(-0.3333333333333333 / z))); elseif (y <= 1.1e-158) tmp = Float64(x + Float64(1.0 / Float64(y / Float64(Float64(t / z) * 0.3333333333333333)))); else tmp = Float64(x + Float64(Float64(-0.3333333333333333 * t_1) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y - (t / y); tmp = 0.0; if (y <= -3.8e-88) tmp = x + (t_1 * (-0.3333333333333333 / z)); elseif (y <= 1.1e-158) tmp = x + (1.0 / (y / ((t / z) * 0.3333333333333333))); else tmp = x + ((-0.3333333333333333 * t_1) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e-88], N[(x + N[(t$95$1 * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-158], N[(x + N[(1.0 / N[(y / N[(N[(t / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-0.3333333333333333 * t$95$1), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{t}{y}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{-88}:\\
\;\;\;\;x + t_1 \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-158}:\\
\;\;\;\;x + \frac{1}{\frac{y}{\frac{t}{z} \cdot 0.3333333333333333}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot t_1}{z}\\
\end{array}
\end{array}
if y < -3.80000000000000011e-88Initial program 97.3%
Simplified99.7%
if -3.80000000000000011e-88 < y < 1.1000000000000001e-158Initial program 90.0%
Simplified86.8%
Taylor expanded in y around 0 89.7%
associate-*r/89.7%
metadata-eval89.7%
distribute-lft-neg-in89.7%
distribute-frac-neg89.7%
associate-*r/89.7%
associate-/l/98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*r/98.5%
associate-*r/98.4%
associate-/l*98.3%
associate-*l/98.3%
associate-*r/98.3%
associate-/r*98.3%
associate-*r/98.4%
metadata-eval98.4%
distribute-neg-frac98.4%
metadata-eval98.4%
associate-*r/89.7%
Simplified89.7%
clear-num89.7%
inv-pow89.7%
associate-/l*98.4%
associate-/l/98.5%
Applied egg-rr98.5%
unpow-198.5%
Simplified98.5%
if 1.1000000000000001e-158 < y Initial program 93.5%
Simplified99.7%
associate-*l/99.7%
Applied egg-rr99.7%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (+ x (+ (* -0.3333333333333333 (/ y z)) (/ (/ t z) (* y 3.0)))))
double code(double x, double y, double z, double t) {
return x + ((-0.3333333333333333 * (y / z)) + ((t / z) / (y * 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 + (((-0.3333333333333333d0) * (y / z)) + ((t / z) / (y * 3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((-0.3333333333333333 * (y / z)) + ((t / z) / (y * 3.0)));
}
def code(x, y, z, t): return x + ((-0.3333333333333333 * (y / z)) + ((t / z) / (y * 3.0)))
function code(x, y, z, t) return Float64(x + Float64(Float64(-0.3333333333333333 * Float64(y / z)) + Float64(Float64(t / z) / Float64(y * 3.0)))) end
function tmp = code(x, y, z, t) tmp = x + ((-0.3333333333333333 * (y / z)) + ((t / z) / (y * 3.0))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(N[(t / z), $MachinePrecision] / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-0.3333333333333333 \cdot \frac{y}{z} + \frac{\frac{t}{z}}{y \cdot 3}\right)
\end{array}
Initial program 93.5%
Simplified93.5%
fma-udef93.5%
associate-/r*97.1%
Applied egg-rr97.1%
Final simplification97.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1900.0)
(+ x (/ y (* z -3.0)))
(if (<= y 6.8e-17)
(+ 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 <= -1900.0) {
tmp = x + (y / (z * -3.0));
} else if (y <= 6.8e-17) {
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 <= (-1900.0d0)) then
tmp = x + (y / (z * (-3.0d0)))
else if (y <= 6.8d-17) 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 <= -1900.0) {
tmp = x + (y / (z * -3.0));
} else if (y <= 6.8e-17) {
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 <= -1900.0: tmp = x + (y / (z * -3.0)) elif y <= 6.8e-17: 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 <= -1900.0) tmp = Float64(x + Float64(y / Float64(z * -3.0))); elseif (y <= 6.8e-17) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1900.0) tmp = x + (y / (z * -3.0)); elseif (y <= 6.8e-17) 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, -1900.0], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e-17], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1900:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-17}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -1900Initial program 98.1%
Simplified99.8%
Taylor expanded in y around inf 94.6%
*-commutative94.6%
clear-num94.5%
un-div-inv94.6%
div-inv94.7%
metadata-eval94.7%
Applied egg-rr94.7%
if -1900 < y < 6.7999999999999996e-17Initial program 89.6%
Simplified92.0%
Taylor expanded in y around 0 85.8%
if 6.7999999999999996e-17 < y Initial program 97.5%
Simplified99.7%
Taylor expanded in y around inf 94.6%
Final simplification90.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1950.0)
(+ x (/ y (* z -3.0)))
(if (<= y 2.8e-17)
(+ 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 <= -1950.0) {
tmp = x + (y / (z * -3.0));
} else if (y <= 2.8e-17) {
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 <= (-1950.0d0)) then
tmp = x + (y / (z * (-3.0d0)))
else if (y <= 2.8d-17) 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 <= -1950.0) {
tmp = x + (y / (z * -3.0));
} else if (y <= 2.8e-17) {
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 <= -1950.0: tmp = x + (y / (z * -3.0)) elif y <= 2.8e-17: 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 <= -1950.0) tmp = Float64(x + Float64(y / Float64(z * -3.0))); elseif (y <= 2.8e-17) tmp = Float64(x + Float64(0.3333333333333333 * Float64(Float64(t / z) / y))); else tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1950.0) tmp = x + (y / (z * -3.0)); elseif (y <= 2.8e-17) 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, -1950.0], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e-17], N[(x + N[(0.3333333333333333 * N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1950:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-17}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\end{array}
\end{array}
if y < -1950Initial program 98.1%
Simplified99.8%
Taylor expanded in y around inf 94.6%
*-commutative94.6%
clear-num94.5%
un-div-inv94.6%
div-inv94.7%
metadata-eval94.7%
Applied egg-rr94.7%
if -1950 < y < 2.7999999999999999e-17Initial program 89.6%
Simplified92.0%
Taylor expanded in y around 0 85.8%
associate-*r/85.8%
metadata-eval85.8%
distribute-lft-neg-in85.8%
distribute-frac-neg85.8%
associate-*r/85.8%
associate-/l/93.2%
associate-*r/93.2%
*-rgt-identity93.2%
associate-*r/93.2%
associate-*r/93.1%
associate-/l*93.1%
associate-*l/93.1%
associate-*r/93.1%
associate-/r*93.1%
associate-*r/93.1%
metadata-eval93.1%
distribute-neg-frac93.1%
metadata-eval93.1%
associate-*r/85.8%
Simplified85.8%
clear-num85.8%
associate-/r/85.7%
clear-num85.8%
*-commutative85.8%
associate-/r*93.2%
Applied egg-rr93.2%
if 2.7999999999999999e-17 < y Initial program 97.5%
Simplified99.7%
Taylor expanded in y around inf 94.6%
Final simplification93.9%
(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.5%
Simplified95.7%
Taylor expanded in y around inf 60.2%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (+ x (/ y (* z -3.0))))
double code(double x, double y, double z, double t) {
return x + (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 + (y / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + (y / (z * -3.0));
}
def code(x, y, z, t): return x + (y / (z * -3.0))
function code(x, y, z, t) return Float64(x + Float64(y / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x + (y / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{z \cdot -3}
\end{array}
Initial program 93.5%
Simplified95.7%
Taylor expanded in y around inf 60.2%
*-commutative60.2%
clear-num60.1%
un-div-inv60.2%
div-inv60.2%
metadata-eval60.2%
Applied egg-rr60.2%
Final simplification60.2%
(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.5%
Simplified95.7%
Taylor expanded in y around inf 60.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 2023310
(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))))