
(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 (+ x (/ (- y (/ t y)) (* z -3.0))))
double code(double x, double y, double z, double t) {
return x + ((y - (t / 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 - (t / y)) / (z * (-3.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - (t / y)) / (z * -3.0));
}
def code(x, y, z, t): return x + ((y - (t / y)) / (z * -3.0))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0))) end
function tmp = code(x, y, z, t) tmp = x + ((y - (t / y)) / (z * -3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - \frac{t}{y}}{z \cdot -3}
\end{array}
Initial program 97.2%
sub-neg97.2%
associate-+l+97.2%
remove-double-neg97.2%
distribute-frac-neg97.2%
sub-neg97.2%
distribute-frac-neg97.2%
neg-mul-197.2%
*-commutative97.2%
associate-/l*97.2%
*-commutative97.2%
neg-mul-197.2%
times-frac97.9%
distribute-lft-out--97.9%
*-commutative97.9%
associate-/r*97.9%
metadata-eval97.9%
Simplified97.9%
*-commutative97.9%
clear-num97.9%
un-div-inv97.9%
div-inv98.0%
metadata-eval98.0%
Applied egg-rr98.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -9.6e-102)
(* y (+ (/ x y) (* 0.3333333333333333 (/ -1.0 z))))
(if (<= y 1.7e+39)
(+ x (* 0.3333333333333333 (/ t (* y z))))
(+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.6e-102) {
tmp = y * ((x / y) + (0.3333333333333333 * (-1.0 / z)));
} else if (y <= 1.7e+39) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-9.6d-102)) then
tmp = y * ((x / y) + (0.3333333333333333d0 * ((-1.0d0) / z)))
else if (y <= 1.7d+39) then
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
else
tmp = x + (y / (z * (-3.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.6e-102) {
tmp = y * ((x / y) + (0.3333333333333333 * (-1.0 / z)));
} else if (y <= 1.7e+39) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.6e-102: tmp = y * ((x / y) + (0.3333333333333333 * (-1.0 / z))) elif y <= 1.7e+39: tmp = x + (0.3333333333333333 * (t / (y * z))) else: tmp = x + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.6e-102) tmp = Float64(y * Float64(Float64(x / y) + Float64(0.3333333333333333 * Float64(-1.0 / z)))); elseif (y <= 1.7e+39) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.6e-102) tmp = y * ((x / y) + (0.3333333333333333 * (-1.0 / z))); elseif (y <= 1.7e+39) tmp = x + (0.3333333333333333 * (t / (y * z))); else tmp = x + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.6e-102], N[(y * N[(N[(x / y), $MachinePrecision] + N[(0.3333333333333333 * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e+39], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{-102}:\\
\;\;\;\;y \cdot \left(\frac{x}{y} + 0.3333333333333333 \cdot \frac{-1}{z}\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+39}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -9.6e-102Initial program 97.5%
sub-neg97.5%
associate-+l+97.5%
distribute-frac-neg97.5%
neg-mul-197.5%
*-commutative97.5%
times-frac97.5%
fma-define97.5%
metadata-eval97.5%
associate-*l*97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in y around inf 89.9%
if -9.6e-102 < y < 1.6999999999999999e39Initial program 96.5%
sub-neg96.5%
associate-+l+96.5%
remove-double-neg96.5%
distribute-frac-neg96.5%
sub-neg96.5%
distribute-frac-neg96.5%
neg-mul-196.5%
*-commutative96.5%
associate-/l*96.5%
*-commutative96.5%
neg-mul-196.5%
times-frac95.6%
distribute-lft-out--95.6%
*-commutative95.6%
associate-/r*95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in y around 0 90.7%
if 1.6999999999999999e39 < y Initial program 98.2%
sub-neg98.2%
associate-+l+98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
sub-neg98.2%
distribute-frac-neg98.2%
neg-mul-198.2%
*-commutative98.2%
associate-/l*97.9%
*-commutative97.9%
neg-mul-197.9%
times-frac99.5%
distribute-lft-out--99.5%
*-commutative99.5%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.7%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 93.4%
Final simplification91.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.1e+16)
(- x (* 0.3333333333333333 (/ y z)))
(if (<= y 1.6e+39)
(+ x (* 0.3333333333333333 (/ t (* y z))))
(+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e+16) {
tmp = x - (0.3333333333333333 * (y / z));
} else if (y <= 1.6e+39) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.1d+16)) then
tmp = x - (0.3333333333333333d0 * (y / z))
else if (y <= 1.6d+39) then
tmp = x + (0.3333333333333333d0 * (t / (y * z)))
else
tmp = x + (y / (z * (-3.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e+16) {
tmp = x - (0.3333333333333333 * (y / z));
} else if (y <= 1.6e+39) {
tmp = x + (0.3333333333333333 * (t / (y * z)));
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e+16: tmp = x - (0.3333333333333333 * (y / z)) elif y <= 1.6e+39: tmp = x + (0.3333333333333333 * (t / (y * z))) else: tmp = x + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e+16) tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); elseif (y <= 1.6e+39) tmp = Float64(x + Float64(0.3333333333333333 * Float64(t / Float64(y * z)))); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e+16) tmp = x - (0.3333333333333333 * (y / z)); elseif (y <= 1.6e+39) tmp = x + (0.3333333333333333 * (t / (y * z))); else tmp = x + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e+16], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+39], N[(x + N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+16}:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+39}:\\
\;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -1.1e16Initial program 99.8%
Taylor expanded in t around 0 96.0%
if -1.1e16 < y < 1.59999999999999996e39Initial program 95.6%
sub-neg95.6%
associate-+l+95.6%
remove-double-neg95.6%
distribute-frac-neg95.6%
sub-neg95.6%
distribute-frac-neg95.6%
neg-mul-195.6%
*-commutative95.6%
associate-/l*95.6%
*-commutative95.6%
neg-mul-195.6%
times-frac96.2%
distribute-lft-out--96.2%
*-commutative96.2%
associate-/r*96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in y around 0 87.6%
if 1.59999999999999996e39 < y Initial program 98.2%
sub-neg98.2%
associate-+l+98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
sub-neg98.2%
distribute-frac-neg98.2%
neg-mul-198.2%
*-commutative98.2%
associate-/l*97.9%
*-commutative97.9%
neg-mul-197.9%
times-frac99.5%
distribute-lft-out--99.5%
*-commutative99.5%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
*-commutative99.6%
clear-num99.5%
un-div-inv99.7%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 93.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.1e-103) (not (<= y 9.2e-93))) (+ x (/ y (* z -3.0))) (* (/ t z) (/ 0.3333333333333333 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.1e-103) || !(y <= 9.2e-93)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = (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 <= (-3.1d-103)) .or. (.not. (y <= 9.2d-93))) then
tmp = x + (y / (z * (-3.0d0)))
else
tmp = (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 <= -3.1e-103) || !(y <= 9.2e-93)) {
tmp = x + (y / (z * -3.0));
} else {
tmp = (t / z) * (0.3333333333333333 / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.1e-103) or not (y <= 9.2e-93): tmp = x + (y / (z * -3.0)) else: tmp = (t / z) * (0.3333333333333333 / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.1e-103) || !(y <= 9.2e-93)) tmp = Float64(x + Float64(y / Float64(z * -3.0))); else tmp = 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 <= -3.1e-103) || ~((y <= 9.2e-93))) tmp = x + (y / (z * -3.0)); else tmp = (t / z) * (0.3333333333333333 / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.1e-103], N[Not[LessEqual[y, 9.2e-93]], $MachinePrecision]], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-103} \lor \neg \left(y \leq 9.2 \cdot 10^{-93}\right):\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -3.1000000000000001e-103 or 9.1999999999999993e-93 < y Initial program 98.1%
sub-neg98.1%
associate-+l+98.1%
remove-double-neg98.1%
distribute-frac-neg98.1%
sub-neg98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.0%
*-commutative98.0%
neg-mul-198.0%
times-frac99.7%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.8%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 85.3%
if -3.1000000000000001e-103 < y < 9.1999999999999993e-93Initial program 95.5%
sub-neg95.5%
associate-+l+95.5%
distribute-frac-neg95.5%
neg-mul-195.5%
*-commutative95.5%
times-frac95.5%
fma-define95.5%
metadata-eval95.5%
associate-*l*95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in y around 0 94.2%
Taylor expanded in t around inf 67.5%
div-inv67.5%
*-commutative67.5%
associate-*l*67.6%
div-inv67.6%
Applied egg-rr67.6%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.6e-102) (not (<= y 9e-93))) (+ x (* y (/ -0.3333333333333333 z))) (* (/ t z) (/ 0.3333333333333333 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.6e-102) || !(y <= 9e-93)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = (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 <= (-9.6d-102)) .or. (.not. (y <= 9d-93))) then
tmp = x + (y * ((-0.3333333333333333d0) / z))
else
tmp = (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 <= -9.6e-102) || !(y <= 9e-93)) {
tmp = x + (y * (-0.3333333333333333 / z));
} else {
tmp = (t / z) * (0.3333333333333333 / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.6e-102) or not (y <= 9e-93): tmp = x + (y * (-0.3333333333333333 / z)) else: tmp = (t / z) * (0.3333333333333333 / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.6e-102) || !(y <= 9e-93)) tmp = Float64(x + Float64(y * Float64(-0.3333333333333333 / z))); else tmp = 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 <= -9.6e-102) || ~((y <= 9e-93))) tmp = x + (y * (-0.3333333333333333 / z)); else tmp = (t / z) * (0.3333333333333333 / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.6e-102], N[Not[LessEqual[y, 9e-93]], $MachinePrecision]], N[(x + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{-102} \lor \neg \left(y \leq 9 \cdot 10^{-93}\right):\\
\;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\end{array}
\end{array}
if y < -9.6e-102 or 9.0000000000000004e-93 < y Initial program 98.1%
sub-neg98.1%
associate-+l+98.1%
remove-double-neg98.1%
distribute-frac-neg98.1%
sub-neg98.1%
distribute-frac-neg98.1%
neg-mul-198.1%
*-commutative98.1%
associate-/l*98.0%
*-commutative98.0%
neg-mul-198.0%
times-frac99.7%
distribute-lft-out--99.7%
*-commutative99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 85.2%
if -9.6e-102 < y < 9.0000000000000004e-93Initial program 95.5%
sub-neg95.5%
associate-+l+95.5%
distribute-frac-neg95.5%
neg-mul-195.5%
*-commutative95.5%
times-frac95.5%
fma-define95.5%
metadata-eval95.5%
associate-*l*95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in y around 0 94.2%
Taylor expanded in t around inf 67.5%
div-inv67.5%
*-commutative67.5%
associate-*l*67.6%
div-inv67.6%
Applied egg-rr67.6%
Final simplification79.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -7.8e-104)
(- x (* 0.3333333333333333 (/ y z)))
(if (<= y 9.2e-93)
(* (/ t z) (/ 0.3333333333333333 y))
(+ x (/ y (* z -3.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.8e-104) {
tmp = x - (0.3333333333333333 * (y / z));
} else if (y <= 9.2e-93) {
tmp = (t / z) * (0.3333333333333333 / y);
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-7.8d-104)) then
tmp = x - (0.3333333333333333d0 * (y / z))
else if (y <= 9.2d-93) then
tmp = (t / z) * (0.3333333333333333d0 / y)
else
tmp = x + (y / (z * (-3.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.8e-104) {
tmp = x - (0.3333333333333333 * (y / z));
} else if (y <= 9.2e-93) {
tmp = (t / z) * (0.3333333333333333 / y);
} else {
tmp = x + (y / (z * -3.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.8e-104: tmp = x - (0.3333333333333333 * (y / z)) elif y <= 9.2e-93: tmp = (t / z) * (0.3333333333333333 / y) else: tmp = x + (y / (z * -3.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.8e-104) tmp = Float64(x - Float64(0.3333333333333333 * Float64(y / z))); elseif (y <= 9.2e-93) tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y)); else tmp = Float64(x + Float64(y / Float64(z * -3.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.8e-104) tmp = x - (0.3333333333333333 * (y / z)); elseif (y <= 9.2e-93) tmp = (t / z) * (0.3333333333333333 / y); else tmp = x + (y / (z * -3.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.8e-104], N[(x - N[(0.3333333333333333 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.2e-93], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-104}:\\
\;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-93}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -7.8000000000000004e-104Initial program 97.5%
Taylor expanded in t around 0 89.1%
if -7.8000000000000004e-104 < y < 9.1999999999999993e-93Initial program 95.5%
sub-neg95.5%
associate-+l+95.5%
distribute-frac-neg95.5%
neg-mul-195.5%
*-commutative95.5%
times-frac95.5%
fma-define95.5%
metadata-eval95.5%
associate-*l*95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in y around 0 94.2%
Taylor expanded in t around inf 67.5%
div-inv67.5%
*-commutative67.5%
associate-*l*67.6%
div-inv67.6%
Applied egg-rr67.6%
if 9.1999999999999993e-93 < y Initial program 98.7%
sub-neg98.7%
associate-+l+98.7%
remove-double-neg98.7%
distribute-frac-neg98.7%
sub-neg98.7%
distribute-frac-neg98.7%
neg-mul-198.7%
*-commutative98.7%
associate-/l*98.5%
*-commutative98.5%
neg-mul-198.5%
times-frac99.6%
distribute-lft-out--99.6%
*-commutative99.6%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.6%
un-div-inv99.7%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 81.8%
(FPCore (x y z t) :precision binary64 (if (<= z -9e+71) x (if (<= z 1.85e+51) (* (/ t z) (/ 0.3333333333333333 y)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9e+71) {
tmp = x;
} else if (z <= 1.85e+51) {
tmp = (t / z) * (0.3333333333333333 / 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 <= (-9d+71)) then
tmp = x
else if (z <= 1.85d+51) then
tmp = (t / z) * (0.3333333333333333d0 / 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 <= -9e+71) {
tmp = x;
} else if (z <= 1.85e+51) {
tmp = (t / z) * (0.3333333333333333 / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9e+71: tmp = x elif z <= 1.85e+51: tmp = (t / z) * (0.3333333333333333 / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9e+71) tmp = x; elseif (z <= 1.85e+51) tmp = Float64(Float64(t / z) * Float64(0.3333333333333333 / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9e+71) tmp = x; elseif (z <= 1.85e+51) tmp = (t / z) * (0.3333333333333333 / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9e+71], x, If[LessEqual[z, 1.85e+51], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+71}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+51}:\\
\;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.00000000000000087e71 or 1.8500000000000001e51 < z Initial program 99.0%
sub-neg99.0%
associate-+l+99.0%
distribute-frac-neg99.0%
neg-mul-199.0%
*-commutative99.0%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 59.3%
if -9.00000000000000087e71 < z < 1.8500000000000001e51Initial program 95.9%
sub-neg95.9%
associate-+l+95.9%
distribute-frac-neg95.9%
neg-mul-195.9%
*-commutative95.9%
times-frac95.9%
fma-define95.9%
metadata-eval95.9%
associate-*l*95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in y around 0 53.3%
Taylor expanded in t around inf 46.4%
div-inv46.4%
*-commutative46.4%
associate-*l*46.4%
div-inv46.4%
Applied egg-rr46.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.85e+59) x (if (<= z 2.8e+51) (* (/ t y) (/ 0.3333333333333333 z)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.85e+59) {
tmp = x;
} else if (z <= 2.8e+51) {
tmp = (t / 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.85d+59)) then
tmp = x
else if (z <= 2.8d+51) then
tmp = (t / 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.85e+59) {
tmp = x;
} else if (z <= 2.8e+51) {
tmp = (t / y) * (0.3333333333333333 / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.85e+59: tmp = x elif z <= 2.8e+51: tmp = (t / y) * (0.3333333333333333 / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.85e+59) tmp = x; elseif (z <= 2.8e+51) tmp = Float64(Float64(t / 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.85e+59) tmp = x; elseif (z <= 2.8e+51) tmp = (t / y) * (0.3333333333333333 / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.85e+59], x, If[LessEqual[z, 2.8e+51], N[(N[(t / y), $MachinePrecision] * N[(0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+59}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+51}:\\
\;\;\;\;\frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.84999999999999999e59 or 2.80000000000000005e51 < z Initial program 99.0%
sub-neg99.0%
associate-+l+99.0%
distribute-frac-neg99.0%
neg-mul-199.0%
*-commutative99.0%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 59.3%
if -1.84999999999999999e59 < z < 2.80000000000000005e51Initial program 95.9%
sub-neg95.9%
associate-+l+95.9%
distribute-frac-neg95.9%
neg-mul-195.9%
*-commutative95.9%
times-frac95.9%
fma-define95.9%
metadata-eval95.9%
associate-*l*95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in y around 0 53.3%
Taylor expanded in t around inf 46.4%
div-inv46.4%
*-commutative46.4%
associate-*l*46.4%
div-inv46.4%
times-frac43.1%
*-commutative43.1%
times-frac45.7%
Applied egg-rr45.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.4e+60) x (if (<= z 2.75e+51) (* 0.3333333333333333 (/ t (* y z))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.4e+60) {
tmp = x;
} else if (z <= 2.75e+51) {
tmp = 0.3333333333333333 * (t / (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 <= (-1.4d+60)) then
tmp = x
else if (z <= 2.75d+51) then
tmp = 0.3333333333333333d0 * (t / (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 <= -1.4e+60) {
tmp = x;
} else if (z <= 2.75e+51) {
tmp = 0.3333333333333333 * (t / (y * z));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.4e+60: tmp = x elif z <= 2.75e+51: tmp = 0.3333333333333333 * (t / (y * z)) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.4e+60) tmp = x; elseif (z <= 2.75e+51) tmp = Float64(0.3333333333333333 * Float64(t / Float64(y * z))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.4e+60) tmp = x; elseif (z <= 2.75e+51) tmp = 0.3333333333333333 * (t / (y * z)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.4e+60], x, If[LessEqual[z, 2.75e+51], N[(0.3333333333333333 * N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+60}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.75 \cdot 10^{+51}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.4e60 or 2.75e51 < z Initial program 99.0%
sub-neg99.0%
associate-+l+99.0%
distribute-frac-neg99.0%
neg-mul-199.0%
*-commutative99.0%
times-frac98.9%
fma-define98.9%
metadata-eval98.9%
associate-*l*98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 59.3%
if -1.4e60 < z < 2.75e51Initial program 95.9%
sub-neg95.9%
associate-+l+95.9%
distribute-frac-neg95.9%
neg-mul-195.9%
*-commutative95.9%
times-frac95.9%
fma-define95.9%
metadata-eval95.9%
associate-*l*95.9%
*-commutative95.9%
Simplified95.9%
Taylor expanded in y around 0 53.3%
Taylor expanded in t around inf 46.4%
div-inv46.4%
associate-*r/46.4%
frac-times43.1%
*-commutative43.1%
associate-*r/43.1%
div-inv43.1%
associate-/l*43.2%
*-commutative43.2%
Applied egg-rr43.2%
Final simplification50.1%
(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 97.2%
sub-neg97.2%
associate-+l+97.2%
remove-double-neg97.2%
distribute-frac-neg97.2%
sub-neg97.2%
distribute-frac-neg97.2%
neg-mul-197.2%
*-commutative97.2%
associate-/l*97.2%
*-commutative97.2%
neg-mul-197.2%
times-frac97.9%
distribute-lft-out--97.9%
*-commutative97.9%
associate-/r*97.9%
metadata-eval97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.2%
sub-neg97.2%
associate-+l+97.2%
distribute-frac-neg97.2%
neg-mul-197.2%
*-commutative97.2%
times-frac97.2%
fma-define97.2%
metadata-eval97.2%
associate-*l*97.2%
*-commutative97.2%
Simplified97.2%
Taylor expanded in x around inf 30.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 2024165
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:alt
(! :herbie-platform default (+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y)))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))