
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y)); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* z 3.0) 2e-132) (+ x (/ (- (/ t y) y) (* z 3.0))) (+ (- x (/ y (* z 3.0))) (/ t (* z (* 3.0 y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 2e-132) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else {
tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z * 3.0d0) <= 2d-132) then
tmp = x + (((t / y) - y) / (z * 3.0d0))
else
tmp = (x - (y / (z * 3.0d0))) + (t / (z * (3.0d0 * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 2e-132) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else {
tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * 3.0) <= 2e-132: tmp = x + (((t / y) - y) / (z * 3.0)) else: tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= 2e-132) tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); else tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(z * Float64(3.0 * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * 3.0) <= 2e-132) tmp = x + (((t / y) - y) / (z * 3.0)); else tmp = (x - (y / (z * 3.0))) + (t / (z * (3.0 * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 2e-132], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(3.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 2 \cdot 10^{-132}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < 2e-132Initial program 92.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if 2e-132 < (*.f64 z #s(literal 3 binary64)) Initial program 99.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z 3.0) 2e-132) (+ x (/ (- (/ t y) y) (* z 3.0))) (fma (/ t (* z y)) 0.3333333333333333 (fma y (/ -0.3333333333333333 z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * 3.0) <= 2e-132) {
tmp = x + (((t / y) - y) / (z * 3.0));
} else {
tmp = fma((t / (z * y)), 0.3333333333333333, fma(y, (-0.3333333333333333 / z), x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * 3.0) <= 2e-132) tmp = Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))); else tmp = fma(Float64(t / Float64(z * y)), 0.3333333333333333, fma(y, Float64(-0.3333333333333333 / z), x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 2e-132], N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 2 \cdot 10^{-132}:\\
\;\;\;\;x + \frac{\frac{t}{y} - y}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z \cdot y}, 0.3333333333333333, \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\right)\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < 2e-132Initial program 92.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if 2e-132 < (*.f64 z #s(literal 3 binary64)) Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
metadata-eval99.8
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
div-invN/A
lower-fma.f64N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y (/ -0.3333333333333333 z) x)))
(if (<= y -4.8e+45)
t_1
(if (<= y 4.1e+41) (+ x (/ (/ t y) (* z 3.0))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -4.8e+45) {
tmp = t_1;
} else if (y <= 4.1e+41) {
tmp = x + ((t / y) / (z * 3.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -4.8e+45) tmp = t_1; elseif (y <= 4.1e+41) tmp = Float64(x + Float64(Float64(t / y) / Float64(z * 3.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+45], t$95$1, If[LessEqual[y, 4.1e+41], N[(x + N[(N[(t / y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+41}:\\
\;\;\;\;x + \frac{\frac{t}{y}}{z \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.79999999999999979e45 or 4.1000000000000004e41 < y Initial program 99.8%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites97.2%
if -4.79999999999999979e45 < y < 4.1000000000000004e41Initial program 92.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Taylor expanded in t around inf
Applied rewrites89.2%
Applied rewrites89.3%
Final simplification92.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y (/ -0.3333333333333333 z) x)))
(if (<= y -4.8e+45)
t_1
(if (<= y 4.1e+41) (fma (/ 0.3333333333333333 z) (/ t y) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -4.8e+45) {
tmp = t_1;
} else if (y <= 4.1e+41) {
tmp = fma((0.3333333333333333 / z), (t / y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -4.8e+45) tmp = t_1; elseif (y <= 4.1e+41) tmp = fma(Float64(0.3333333333333333 / z), Float64(t / y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+45], t$95$1, If[LessEqual[y, 4.1e+41], N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(t / y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(\frac{0.3333333333333333}{z}, \frac{t}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.79999999999999979e45 or 4.1000000000000004e41 < y Initial program 99.8%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites97.2%
if -4.79999999999999979e45 < y < 4.1000000000000004e41Initial program 92.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Taylor expanded in t around inf
Applied rewrites89.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y (/ -0.3333333333333333 z) x)))
(if (<= y -4.8e+45)
t_1
(if (<= y 4.1e+41) (fma 0.3333333333333333 (/ t (* z y)) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -4.8e+45) {
tmp = t_1;
} else if (y <= 4.1e+41) {
tmp = fma(0.3333333333333333, (t / (z * y)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -4.8e+45) tmp = t_1; elseif (y <= 4.1e+41) tmp = fma(0.3333333333333333, Float64(t / Float64(z * y)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+45], t$95$1, If[LessEqual[y, 4.1e+41], N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{t}{z \cdot y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.79999999999999979e45 or 4.1000000000000004e41 < y Initial program 99.8%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites97.2%
if -4.79999999999999979e45 < y < 4.1000000000000004e41Initial program 92.2%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites96.1%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f6486.5
Applied rewrites86.5%
Final simplification90.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y (/ -0.3333333333333333 z) x)))
(if (<= y -4.8e+45)
t_1
(if (<= y 4.1e+41) (fma t (/ 0.3333333333333333 (* z y)) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -4.8e+45) {
tmp = t_1;
} else if (y <= 4.1e+41) {
tmp = fma(t, (0.3333333333333333 / (z * y)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -4.8e+45) tmp = t_1; elseif (y <= 4.1e+41) tmp = fma(t, Float64(0.3333333333333333 / Float64(z * y)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -4.8e+45], t$95$1, If[LessEqual[y, 4.1e+41], N[(t * N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{0.3333333333333333}{z \cdot y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.79999999999999979e45 or 4.1000000000000004e41 < y Initial program 99.8%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites97.2%
if -4.79999999999999979e45 < y < 4.1000000000000004e41Initial program 92.2%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
Taylor expanded in y around 0
div-subN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
associate-*r/N/A
associate-/r*N/A
times-fracN/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
cancel-sign-subN/A
associate-*r/N/A
metadata-evalN/A
times-fracN/A
*-commutativeN/A
associate-*r/N/A
+-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
Applied rewrites86.2%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y (/ -0.3333333333333333 z) x))) (if (<= y -5.4e-19) t_1 (if (<= y 1.1e-66) (/ t (* (* z 3.0) y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -5.4e-19) {
tmp = t_1;
} else if (y <= 1.1e-66) {
tmp = t / ((z * 3.0) * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -5.4e-19) tmp = t_1; elseif (y <= 1.1e-66) tmp = Float64(t / Float64(Float64(z * 3.0) * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -5.4e-19], t$95$1, If[LessEqual[y, 1.1e-66], N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{t}{\left(z \cdot 3\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.4000000000000002e-19 or 1.1000000000000001e-66 < y Initial program 99.1%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites89.9%
if -5.4000000000000002e-19 < y < 1.1000000000000001e-66Initial program 90.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in y around inf
sub-negN/A
distribute-lft-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6429.4
Applied rewrites29.4%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6463.3
Applied rewrites63.3%
Applied rewrites63.3%
Final simplification77.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y (/ -0.3333333333333333 z) x)))
(if (<= y -5.4e-19)
t_1
(if (<= y 1.1e-66) (* (/ t (* z y)) 0.3333333333333333) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -5.4e-19) {
tmp = t_1;
} else if (y <= 1.1e-66) {
tmp = (t / (z * y)) * 0.3333333333333333;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -5.4e-19) tmp = t_1; elseif (y <= 1.1e-66) tmp = Float64(Float64(t / Float64(z * y)) * 0.3333333333333333); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -5.4e-19], t$95$1, If[LessEqual[y, 1.1e-66], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{t}{z \cdot y} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.4000000000000002e-19 or 1.1000000000000001e-66 < y Initial program 99.1%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites89.9%
if -5.4000000000000002e-19 < y < 1.1000000000000001e-66Initial program 90.6%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Taylor expanded in y around inf
sub-negN/A
distribute-lft-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f6429.4
Applied rewrites29.4%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6463.3
Applied rewrites63.3%
Final simplification77.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y (/ -0.3333333333333333 z) x)))
(if (<= y -5.4e-19)
t_1
(if (<= y 1.1e-66) (/ (* t 0.3333333333333333) (* z y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (-0.3333333333333333 / z), x);
double tmp;
if (y <= -5.4e-19) {
tmp = t_1;
} else if (y <= 1.1e-66) {
tmp = (t * 0.3333333333333333) / (z * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(-0.3333333333333333 / z), x) tmp = 0.0 if (y <= -5.4e-19) tmp = t_1; elseif (y <= 1.1e-66) tmp = Float64(Float64(t * 0.3333333333333333) / Float64(z * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -5.4e-19], t$95$1, If[LessEqual[y, 1.1e-66], N[(N[(t * 0.3333333333333333), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{t \cdot 0.3333333333333333}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.4000000000000002e-19 or 1.1000000000000001e-66 < y Initial program 99.1%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites89.9%
if -5.4000000000000002e-19 < y < 1.1000000000000001e-66Initial program 90.6%
Taylor expanded in y around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6463.3
Applied rewrites63.3%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (+ x (/ (- (/ t y) y) (* z 3.0))))
double code(double x, double y, double z, double t) {
return x + (((t / y) - y) / (z * 3.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + (((t / y) - y) / (z * 3.0d0))
end function
public static double code(double x, double y, double z, double t) {
return x + (((t / y) - y) / (z * 3.0));
}
def code(x, y, z, t): return x + (((t / y) - y) / (z * 3.0))
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(t / y) - y) / Float64(z * 3.0))) end
function tmp = code(x, y, z, t) tmp = x + (((t / y) - y) / (z * 3.0)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{t}{y} - y}{z \cdot 3}
\end{array}
Initial program 95.2%
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6497.6
Applied rewrites97.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (fma (/ 0.3333333333333333 z) (- (/ t y) y) x))
double code(double x, double y, double z, double t) {
return fma((0.3333333333333333 / z), ((t / y) - y), x);
}
function code(x, y, z, t) return fma(Float64(0.3333333333333333 / z), Float64(Float64(t / y) - y), x) end
code[x_, y_, z_, t_] := N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{0.3333333333333333}{z}, \frac{t}{y} - y, x\right)
\end{array}
Initial program 95.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
associate-*l/N/A
metadata-evalN/A
associate-*r/N/A
distribute-lft-out--N/A
lower-fma.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6497.6
Applied rewrites97.6%
(FPCore (x y z t) :precision binary64 (if (<= y -4.7e+45) (* y (/ -0.3333333333333333 z)) (if (<= y 5.6e+37) (/ (* x y) y) (/ y (* z -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.7e+45) {
tmp = y * (-0.3333333333333333 / z);
} else if (y <= 5.6e+37) {
tmp = (x * y) / y;
} else {
tmp = 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 <= (-4.7d+45)) then
tmp = y * ((-0.3333333333333333d0) / z)
else if (y <= 5.6d+37) then
tmp = (x * y) / y
else
tmp = 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 <= -4.7e+45) {
tmp = y * (-0.3333333333333333 / z);
} else if (y <= 5.6e+37) {
tmp = (x * y) / y;
} else {
tmp = y / (z * -3.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.7e+45: tmp = y * (-0.3333333333333333 / z) elif y <= 5.6e+37: tmp = (x * y) / y else: tmp = y / (z * -3.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.7e+45) tmp = Float64(y * Float64(-0.3333333333333333 / z)); elseif (y <= 5.6e+37) tmp = Float64(Float64(x * y) / y); else tmp = Float64(y / Float64(z * -3.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.7e+45) tmp = y * (-0.3333333333333333 / z); elseif (y <= 5.6e+37) tmp = (x * y) / y; else tmp = y / (z * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.7e+45], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e+37], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+45}:\\
\;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+37}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot -3}\\
\end{array}
\end{array}
if y < -4.70000000000000002e45Initial program 99.7%
Taylor expanded in y around inf
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6476.2
Applied rewrites76.2%
if -4.70000000000000002e45 < y < 5.5999999999999996e37Initial program 92.1%
Taylor expanded in y around 0
lower-/.f64N/A
Applied rewrites98.5%
Taylor expanded in z around inf
Applied rewrites33.1%
if 5.5999999999999996e37 < y Initial program 99.8%
Taylor expanded in y around inf
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6473.9
Applied rewrites73.9%
Applied rewrites74.0%
Final simplification49.9%
(FPCore (x y z t) :precision binary64 (fma y (/ -0.3333333333333333 z) x))
double code(double x, double y, double z, double t) {
return fma(y, (-0.3333333333333333 / z), x);
}
function code(x, y, z, t) return fma(y, Float64(-0.3333333333333333 / z), x) end
code[x_, y_, z_, t_] := N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)
\end{array}
Initial program 95.2%
Taylor expanded in y around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*l/N/A
associate-*r/N/A
cancel-sign-subN/A
mul-1-negN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
mul-1-negN/A
*-inversesN/A
cancel-sign-subN/A
*-rgt-identityN/A
Applied rewrites62.0%
(FPCore (x y z t) :precision binary64 (/ y (* z -3.0)))
double code(double x, double y, double z, double t) {
return 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 = y / (z * (-3.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y / (z * -3.0);
}
def code(x, y, z, t): return y / (z * -3.0)
function code(x, y, z, t) return Float64(y / Float64(z * -3.0)) end
function tmp = code(x, y, z, t) tmp = y / (z * -3.0); end
code[x_, y_, z_, t_] := N[(y / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z \cdot -3}
\end{array}
Initial program 95.2%
Taylor expanded in y around inf
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6435.0
Applied rewrites35.0%
Applied rewrites35.0%
(FPCore (x y z t) :precision binary64 (* y (/ -0.3333333333333333 z)))
double code(double x, double y, double z, double t) {
return 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 = y * ((-0.3333333333333333d0) / z)
end function
public static double code(double x, double y, double z, double t) {
return y * (-0.3333333333333333 / z);
}
def code(x, y, z, t): return y * (-0.3333333333333333 / z)
function code(x, y, z, t) return Float64(y * Float64(-0.3333333333333333 / z)) end
function tmp = code(x, y, z, t) tmp = y * (-0.3333333333333333 / z); end
code[x_, y_, z_, t_] := N[(y * N[(-0.3333333333333333 / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{-0.3333333333333333}{z}
\end{array}
Initial program 95.2%
Taylor expanded in y around inf
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6435.0
Applied rewrites35.0%
(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 2024238
(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))))