
(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 (<= y -3.5e-124) (+ x (/ (* -0.3333333333333333 (- y (/ t y))) z)) (+ (+ x (* -0.3333333333333333 (/ y z))) (/ (/ t z) (* y 3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-124) {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
} else {
tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) / (y * 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 <= (-3.5d-124)) then
tmp = x + (((-0.3333333333333333d0) * (y - (t / y))) / z)
else
tmp = (x + ((-0.3333333333333333d0) * (y / z))) + ((t / z) / (y * 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-124) {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
} else {
tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) / (y * 3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.5e-124: tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z) else: tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) / (y * 3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.5e-124) tmp = Float64(x + Float64(Float64(-0.3333333333333333 * Float64(y - Float64(t / y))) / z)); else tmp = Float64(Float64(x + Float64(-0.3333333333333333 * Float64(y / z))) + Float64(Float64(t / z) / Float64(y * 3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.5e-124) tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z); else tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) / (y * 3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.5e-124], N[(x + N[(N[(-0.3333333333333333 * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / z), $MachinePrecision] / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-124}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot \left(y - \frac{t}{y}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -0.3333333333333333 \cdot \frac{y}{z}\right) + \frac{\frac{t}{z}}{y \cdot 3}\\
\end{array}
\end{array}
if y < -3.4999999999999999e-124Initial program 96.1%
Simplified99.7%
associate-*l/99.8%
Applied egg-rr99.8%
if -3.4999999999999999e-124 < y Initial program 92.6%
sub-neg92.6%
distribute-frac-neg92.6%
neg-mul-192.6%
*-commutative92.6%
times-frac92.7%
metadata-eval92.7%
associate-/l/94.6%
associate-/l/94.6%
Simplified94.6%
associate-/l/94.6%
div-inv94.6%
times-frac99.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 99.1%
clear-num99.1%
un-div-inv99.2%
div-inv99.2%
metadata-eval99.2%
Applied egg-rr99.2%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -5e-73)
(+ x (/ (* -0.3333333333333333 (- y (/ t y))) z))
(+
(+ x (* -0.3333333333333333 (/ y z)))
(* (/ t z) (/ 0.3333333333333333 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5e-73) {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
} else {
tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) * (0.3333333333333333 / 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 <= (-5d-73)) then
tmp = x + (((-0.3333333333333333d0) * (y - (t / y))) / z)
else
tmp = (x + ((-0.3333333333333333d0) * (y / z))) + ((t / z) * (0.3333333333333333d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5e-73) {
tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z);
} else {
tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) * (0.3333333333333333 / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5e-73: tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z) else: tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) * (0.3333333333333333 / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5e-73) tmp = Float64(x + Float64(Float64(-0.3333333333333333 * Float64(y - Float64(t / y))) / z)); else tmp = Float64(Float64(x + Float64(-0.3333333333333333 * Float64(y / z))) + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5e-73) tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z); else tmp = (x + (-0.3333333333333333 * (y / z))) + ((t / z) * (0.3333333333333333 / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5e-73], N[(x + N[(N[(-0.3333333333333333 * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-73}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot \left(y - \frac{t}{y}\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -0.3333333333333333 \cdot \frac{y}{z}\right) + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -4.9999999999999998e-73Initial program 98.4%
Simplified99.7%
associate-*l/99.8%
Applied egg-rr99.8%
if -4.9999999999999998e-73 < y Initial program 92.0%
sub-neg92.0%
distribute-frac-neg92.0%
neg-mul-192.0%
*-commutative92.0%
times-frac92.0%
metadata-eval92.0%
associate-/l/94.9%
associate-/l/94.9%
Simplified94.9%
associate-/l/94.9%
div-inv94.9%
times-frac99.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 99.2%
Final simplification99.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (/ t y))))
(if (<= y -1.2e-75)
(+ x (/ (* -0.3333333333333333 t_1) z))
(if (<= y 4.8e-145)
(+ x (* (/ t z) (/ 0.3333333333333333 y)))
(+ 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 <= -1.2e-75) {
tmp = x + ((-0.3333333333333333 * t_1) / z);
} else if (y <= 4.8e-145) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} 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 <= (-1.2d-75)) then
tmp = x + (((-0.3333333333333333d0) * t_1) / z)
else if (y <= 4.8d-145) then
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
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 <= -1.2e-75) {
tmp = x + ((-0.3333333333333333 * t_1) / z);
} else if (y <= 4.8e-145) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} 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 <= -1.2e-75: tmp = x + ((-0.3333333333333333 * t_1) / z) elif y <= 4.8e-145: tmp = x + ((t / z) * (0.3333333333333333 / y)) 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 <= -1.2e-75) tmp = Float64(x + Float64(Float64(-0.3333333333333333 * t_1) / z)); elseif (y <= 4.8e-145) tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); else tmp = Float64(x + Float64(-0.3333333333333333 * Float64(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 <= -1.2e-75) tmp = x + ((-0.3333333333333333 * t_1) / z); elseif (y <= 4.8e-145) tmp = x + ((t / z) * (0.3333333333333333 / y)); 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, -1.2e-75], N[(x + N[(N[(-0.3333333333333333 * t$95$1), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e-145], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-0.3333333333333333 * N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{t}{y}\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{-75}:\\
\;\;\;\;x + \frac{-0.3333333333333333 \cdot t_1}{z}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-145}:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x + -0.3333333333333333 \cdot \frac{t_1}{z}\\
\end{array}
\end{array}
if y < -1.2000000000000001e-75Initial program 98.4%
Simplified99.7%
associate-*l/99.8%
Applied egg-rr99.8%
if -1.2000000000000001e-75 < y < 4.8000000000000003e-145Initial program 85.2%
Simplified91.0%
associate-*l/91.0%
Applied egg-rr91.0%
Taylor expanded in y around 0 91.0%
*-commutative91.0%
associate-*l/90.9%
associate-*r/91.0%
Simplified91.0%
associate-*l/99.4%
Applied egg-rr99.4%
if 4.8000000000000003e-145 < y Initial program 98.7%
Simplified98.7%
Taylor expanded in x around 0 98.8%
Final simplification99.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.35e+72)
(+ x (/ (* y -0.3333333333333333) z))
(if (<= y 2.9)
(+ x (* (/ t y) (/ 0.3333333333333333 z)))
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.35e+72) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= 2.9) {
tmp = x + ((t / y) * (0.3333333333333333 / z));
} else {
tmp = x - ((y / 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 <= (-1.35d+72)) then
tmp = x + ((y * (-0.3333333333333333d0)) / z)
else if (y <= 2.9d0) then
tmp = x + ((t / y) * (0.3333333333333333d0 / z))
else
tmp = x - ((y / 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 <= -1.35e+72) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= 2.9) {
tmp = x + ((t / y) * (0.3333333333333333 / z));
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.35e+72: tmp = x + ((y * -0.3333333333333333) / z) elif y <= 2.9: tmp = x + ((t / y) * (0.3333333333333333 / z)) else: tmp = x - ((y / z) * 0.3333333333333333) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.35e+72) tmp = Float64(x + Float64(Float64(y * -0.3333333333333333) / z)); elseif (y <= 2.9) tmp = Float64(x + Float64(Float64(t / y) * Float64(0.3333333333333333 / z))); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.35e+72) tmp = x + ((y * -0.3333333333333333) / z); elseif (y <= 2.9) tmp = x + ((t / y) * (0.3333333333333333 / z)); else tmp = x - ((y / z) * 0.3333333333333333); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.35e+72], N[(x + N[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9], N[(x + N[(N[(t / y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+72}:\\
\;\;\;\;x + \frac{y \cdot -0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 2.9:\\
\;\;\;\;x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -1.35e72Initial program 97.7%
Simplified99.7%
associate-*l/99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 97.7%
*-commutative97.7%
Simplified97.7%
if -1.35e72 < y < 2.89999999999999991Initial program 90.1%
Simplified93.6%
Taylor expanded in y around 0 84.7%
associate-/r*88.2%
associate-*r/88.2%
*-commutative88.2%
associate-*r/88.2%
Simplified88.2%
if 2.89999999999999991 < y Initial program 99.8%
Taylor expanded in t around 0 95.0%
Final simplification91.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.35e+72)
(+ x (/ (* y -0.3333333333333333) z))
(if (<= y 17500.0)
(+ x (* (/ t z) (/ 0.3333333333333333 y)))
(- x (* (/ y z) 0.3333333333333333)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.35e+72) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= 17500.0) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x - ((y / 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 <= (-1.35d+72)) then
tmp = x + ((y * (-0.3333333333333333d0)) / z)
else if (y <= 17500.0d0) then
tmp = x + ((t / z) * (0.3333333333333333d0 / y))
else
tmp = x - ((y / 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 <= -1.35e+72) {
tmp = x + ((y * -0.3333333333333333) / z);
} else if (y <= 17500.0) {
tmp = x + ((t / z) * (0.3333333333333333 / y));
} else {
tmp = x - ((y / z) * 0.3333333333333333);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.35e+72: tmp = x + ((y * -0.3333333333333333) / z) elif y <= 17500.0: tmp = x + ((t / z) * (0.3333333333333333 / y)) else: tmp = x - ((y / z) * 0.3333333333333333) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.35e+72) tmp = Float64(x + Float64(Float64(y * -0.3333333333333333) / z)); elseif (y <= 17500.0) tmp = Float64(x + Float64(Float64(t / z) * Float64(0.3333333333333333 / y))); else tmp = Float64(x - Float64(Float64(y / z) * 0.3333333333333333)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.35e+72) tmp = x + ((y * -0.3333333333333333) / z); elseif (y <= 17500.0) tmp = x + ((t / z) * (0.3333333333333333 / y)); else tmp = x - ((y / z) * 0.3333333333333333); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.35e+72], N[(x + N[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 17500.0], N[(x + N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / z), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+72}:\\
\;\;\;\;x + \frac{y \cdot -0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 17500:\\
\;\;\;\;x + \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z} \cdot 0.3333333333333333\\
\end{array}
\end{array}
if y < -1.35e72Initial program 97.7%
Simplified99.7%
associate-*l/99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 97.7%
*-commutative97.7%
Simplified97.7%
if -1.35e72 < y < 17500Initial program 90.1%
Simplified93.6%
associate-*l/93.6%
Applied egg-rr93.6%
Taylor expanded in y around 0 88.2%
*-commutative88.2%
associate-*l/88.2%
associate-*r/88.2%
Simplified88.2%
associate-*l/93.5%
Applied egg-rr93.5%
if 17500 < y Initial program 99.8%
Taylor expanded in t around 0 95.0%
Final simplification94.6%
(FPCore (x y z t) :precision binary64 (+ x (* (- y (/ t y)) (/ -0.3333333333333333 z))))
double code(double x, double y, double z, double t) {
return x + ((y - (t / 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 - (t / y)) * ((-0.3333333333333333d0) / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) * (-0.3333333333333333 / z));
}
def code(x, y, z, t): return x + ((y - (t / y)) * (-0.3333333333333333 / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - Float64(t / y)) * Float64(-0.3333333333333333 / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - (t / y)) * (-0.3333333333333333 / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 93.7%
Simplified96.1%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (+ x (/ (* -0.3333333333333333 (- y (/ t y))) z)))
double code(double x, double y, double z, double t) {
return x + ((-0.3333333333333333 * (y - (t / 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 - (t / y))) / z)
end function
public static double code(double x, double y, double z, double t) {
return x + ((-0.3333333333333333 * (y - (t / y))) / z);
}
def code(x, y, z, t): return x + ((-0.3333333333333333 * (y - (t / y))) / z)
function code(x, y, z, t) return Float64(x + Float64(Float64(-0.3333333333333333 * Float64(y - Float64(t / y))) / z)) end
function tmp = code(x, y, z, t) tmp = x + ((-0.3333333333333333 * (y - (t / y))) / z); end
code[x_, y_, z_, t_] := N[(x + N[(N[(-0.3333333333333333 * N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-0.3333333333333333 \cdot \left(y - \frac{t}{y}\right)}{z}
\end{array}
Initial program 93.7%
Simplified96.1%
associate-*l/96.2%
Applied egg-rr96.2%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (<= z -7.4e+27) x (if (<= z 7.6e-10) (* -0.3333333333333333 (/ y z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e+27) {
tmp = x;
} else if (z <= 7.6e-10) {
tmp = -0.3333333333333333 * (y / z);
} 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 <= (-7.4d+27)) then
tmp = x
else if (z <= 7.6d-10) then
tmp = (-0.3333333333333333d0) * (y / z)
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 <= -7.4e+27) {
tmp = x;
} else if (z <= 7.6e-10) {
tmp = -0.3333333333333333 * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.4e+27: tmp = x elif z <= 7.6e-10: tmp = -0.3333333333333333 * (y / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.4e+27) tmp = x; elseif (z <= 7.6e-10) tmp = Float64(-0.3333333333333333 * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.4e+27) tmp = x; elseif (z <= 7.6e-10) tmp = -0.3333333333333333 * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.4e+27], x, If[LessEqual[z, 7.6e-10], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-10}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.40000000000000004e27 or 7.5999999999999996e-10 < z Initial program 99.8%
Simplified92.2%
Taylor expanded in x around inf 58.1%
if -7.40000000000000004e27 < z < 7.5999999999999996e-10Initial program 88.9%
sub-neg88.9%
distribute-frac-neg88.9%
neg-mul-188.9%
*-commutative88.9%
times-frac88.8%
metadata-eval88.8%
associate-/l/98.4%
associate-/l/98.5%
Simplified98.5%
associate-/l/98.4%
div-inv98.4%
times-frac95.8%
Applied egg-rr95.8%
Taylor expanded in y around inf 44.0%
Final simplification50.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.75e+28) x (if (<= z 2e-10) (* y (/ -0.3333333333333333 z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.75e+28) {
tmp = x;
} else if (z <= 2e-10) {
tmp = y * (-0.3333333333333333 / z);
} 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 <= (-1.75d+28)) then
tmp = x
else if (z <= 2d-10) then
tmp = y * ((-0.3333333333333333d0) / z)
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 <= -1.75e+28) {
tmp = x;
} else if (z <= 2e-10) {
tmp = y * (-0.3333333333333333 / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.75e+28: tmp = x elif z <= 2e-10: tmp = y * (-0.3333333333333333 / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.75e+28) tmp = x; elseif (z <= 2e-10) tmp = Float64(y * Float64(-0.3333333333333333 / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.75e+28) tmp = x; elseif (z <= 2e-10) tmp = y * (-0.3333333333333333 / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.75e+28], x, If[LessEqual[z, 2e-10], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-10}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.75e28 or 2.00000000000000007e-10 < z Initial program 99.8%
Simplified92.2%
Taylor expanded in x around inf 58.1%
if -1.75e28 < z < 2.00000000000000007e-10Initial program 88.9%
sub-neg88.9%
distribute-frac-neg88.9%
neg-mul-188.9%
*-commutative88.9%
times-frac88.8%
metadata-eval88.8%
associate-/l/98.4%
associate-/l/98.5%
Simplified98.5%
associate-/l/98.4%
div-inv98.4%
times-frac95.8%
Applied egg-rr95.8%
Taylor expanded in y around inf 44.0%
associate-*r/44.0%
*-commutative44.0%
associate-*r/44.0%
Simplified44.0%
Final simplification50.2%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e+27) x (if (<= z 8.5e-11) (/ y (* z -3.0)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e+27) {
tmp = x;
} else if (z <= 8.5e-11) {
tmp = y / (z * -3.0);
} 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 <= (-7.5d+27)) then
tmp = x
else if (z <= 8.5d-11) then
tmp = y / (z * (-3.0d0))
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 <= -7.5e+27) {
tmp = x;
} else if (z <= 8.5e-11) {
tmp = y / (z * -3.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e+27: tmp = x elif z <= 8.5e-11: tmp = y / (z * -3.0) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e+27) tmp = x; elseif (z <= 8.5e-11) tmp = Float64(y / Float64(z * -3.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.5e+27) tmp = x; elseif (z <= 8.5e-11) tmp = y / (z * -3.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e+27], x, If[LessEqual[z, 8.5e-11], N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+27}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.5000000000000002e27 or 8.50000000000000037e-11 < z Initial program 99.8%
Simplified92.2%
Taylor expanded in x around inf 58.1%
if -7.5000000000000002e27 < z < 8.50000000000000037e-11Initial program 88.9%
sub-neg88.9%
distribute-frac-neg88.9%
neg-mul-188.9%
*-commutative88.9%
times-frac88.8%
metadata-eval88.8%
associate-/l/98.4%
associate-/l/98.5%
Simplified98.5%
associate-/l/98.4%
div-inv98.4%
times-frac95.8%
Applied egg-rr95.8%
Taylor expanded in y around inf 44.0%
associate-*r/44.0%
*-commutative44.0%
associate-*r/44.0%
Simplified44.0%
clear-num44.0%
un-div-inv44.0%
div-inv44.1%
metadata-eval44.1%
Applied egg-rr44.1%
Final simplification50.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 93.7%
Simplified96.1%
Taylor expanded in y around inf 62.1%
Final simplification62.1%
(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(Float64(y * -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[(N[(y * -0.3333333333333333), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot -0.3333333333333333}{z}
\end{array}
Initial program 93.7%
Simplified96.1%
associate-*l/96.2%
Applied egg-rr96.2%
Taylor expanded in y around inf 62.1%
*-commutative62.1%
Simplified62.1%
Final simplification62.1%
(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.7%
Simplified96.1%
Taylor expanded in x around inf 32.4%
Final simplification32.4%
(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 2023264
(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))))