
(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
(let* ((t_1
(fma
(/ 0.3333333333333333 (* z y))
t
(fma -0.3333333333333333 (/ y z) x))))
(if (<= (* 3.0 z) -5e+15)
t_1
(if (<= (* 3.0 z) 5e-39) (- x (/ (- y (/ t y)) (* 3.0 z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((0.3333333333333333 / (z * y)), t, fma(-0.3333333333333333, (y / z), x));
double tmp;
if ((3.0 * z) <= -5e+15) {
tmp = t_1;
} else if ((3.0 * z) <= 5e-39) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(0.3333333333333333 / Float64(z * y)), t, fma(-0.3333333333333333, Float64(y / z), x)) tmp = 0.0 if (Float64(3.0 * z) <= -5e+15) tmp = t_1; elseif (Float64(3.0 * z) <= 5e-39) tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision] * t + N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(3.0 * z), $MachinePrecision], -5e+15], t$95$1, If[LessEqual[N[(3.0 * z), $MachinePrecision], 5e-39], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{0.3333333333333333}{z \cdot y}, t, \mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\right)\\
\mathbf{if}\;3 \cdot z \leq -5 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;3 \cdot z \leq 5 \cdot 10^{-39}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z #s(literal 3 binary64)) < -5e15 or 4.9999999999999998e-39 < (*.f64 z #s(literal 3 binary64)) Initial program 99.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.0
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-fracN/A
neg-mul-1N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites99.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
if -5e15 < (*.f64 z #s(literal 3 binary64)) < 4.9999999999999998e-39Initial program 90.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-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (/ y (* 3.0 z)) x)))
(if (<= (- (/ t (* (* 3.0 z) y)) t_1) -5e+275)
(- x (/ (- y (/ t y)) (* 3.0 z)))
(- (/ t (* (* 3.0 y) z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y / (3.0 * z)) - x;
double tmp;
if (((t / ((3.0 * z) * y)) - t_1) <= -5e+275) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = (t / ((3.0 * y) * z)) - t_1;
}
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 / (3.0d0 * z)) - x
if (((t / ((3.0d0 * z) * y)) - t_1) <= (-5d+275)) then
tmp = x - ((y - (t / y)) / (3.0d0 * z))
else
tmp = (t / ((3.0d0 * y) * z)) - t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / (3.0 * z)) - x;
double tmp;
if (((t / ((3.0 * z) * y)) - t_1) <= -5e+275) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = (t / ((3.0 * y) * z)) - t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / (3.0 * z)) - x tmp = 0 if ((t / ((3.0 * z) * y)) - t_1) <= -5e+275: tmp = x - ((y - (t / y)) / (3.0 * z)) else: tmp = (t / ((3.0 * y) * z)) - t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / Float64(3.0 * z)) - x) tmp = 0.0 if (Float64(Float64(t / Float64(Float64(3.0 * z) * y)) - t_1) <= -5e+275) tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); else tmp = Float64(Float64(t / Float64(Float64(3.0 * y) * z)) - t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / (3.0 * z)) - x; tmp = 0.0; if (((t / ((3.0 * z) * y)) - t_1) <= -5e+275) tmp = x - ((y - (t / y)) / (3.0 * z)); else tmp = (t / ((3.0 * y) * z)) - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[N[(N[(t / N[(N[(3.0 * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], -5e+275], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / N[(N[(3.0 * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{3 \cdot z} - x\\
\mathbf{if}\;\frac{t}{\left(3 \cdot z\right) \cdot y} - t\_1 \leq -5 \cdot 10^{+275}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\left(3 \cdot y\right) \cdot z} - t\_1\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < -5.0000000000000003e275Initial program 85.5%
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.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
if -5.0000000000000003e275 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 97.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6497.5
Applied rewrites97.5%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (* (* 3.0 z) y))))
(if (<= (- t_1 (- (/ y (* 3.0 z)) x)) -5e+267)
(- x (/ (- y (/ t y)) (* 3.0 z)))
(fma (/ -0.3333333333333333 z) y (+ t_1 x)))))
double code(double x, double y, double z, double t) {
double t_1 = t / ((3.0 * z) * y);
double tmp;
if ((t_1 - ((y / (3.0 * z)) - x)) <= -5e+267) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = fma((-0.3333333333333333 / z), y, (t_1 + x));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(t / Float64(Float64(3.0 * z) * y)) tmp = 0.0 if (Float64(t_1 - Float64(Float64(y / Float64(3.0 * z)) - x)) <= -5e+267) tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); else tmp = fma(Float64(-0.3333333333333333 / z), y, Float64(t_1 + x)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(N[(3.0 * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[(N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], -5e+267], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 / z), $MachinePrecision] * y + N[(t$95$1 + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\left(3 \cdot z\right) \cdot y}\\
\mathbf{if}\;t\_1 - \left(\frac{y}{3 \cdot z} - x\right) \leq -5 \cdot 10^{+267}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-0.3333333333333333}{z}, y, t\_1 + x\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) < -4.9999999999999999e267Initial program 86.7%
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.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
if -4.9999999999999999e267 < (+.f64 (-.f64 x (/.f64 y (*.f64 z #s(literal 3 binary64)))) (/.f64 t (*.f64 (*.f64 z #s(literal 3 binary64)) y))) Initial program 97.4%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
lower-fma.f64N/A
distribute-frac-neg2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-+.f6497.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.3
Applied rewrites97.3%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (- (/ (/ t z) (* 3.0 y)) (- (/ y (* 3.0 z)) x)))
double code(double x, double y, double z, double t) {
return ((t / z) / (3.0 * y)) - ((y / (3.0 * z)) - 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 = ((t / z) / (3.0d0 * y)) - ((y / (3.0d0 * z)) - x)
end function
public static double code(double x, double y, double z, double t) {
return ((t / z) / (3.0 * y)) - ((y / (3.0 * z)) - x);
}
def code(x, y, z, t): return ((t / z) / (3.0 * y)) - ((y / (3.0 * z)) - x)
function code(x, y, z, t) return Float64(Float64(Float64(t / z) / Float64(3.0 * y)) - Float64(Float64(y / Float64(3.0 * z)) - x)) end
function tmp = code(x, y, z, t) tmp = ((t / z) / (3.0 * y)) - ((y / (3.0 * z)) - x); end
code[x_, y_, z_, t_] := N[(N[(N[(t / z), $MachinePrecision] / N[(3.0 * y), $MachinePrecision]), $MachinePrecision] - N[(N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t}{z}}{3 \cdot y} - \left(\frac{y}{3 \cdot z} - x\right)
\end{array}
Initial program 94.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6498.4
Applied rewrites98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ (- y (/ t y)) (* 3.0 z)))))
(if (<= y -3.7e-126)
t_1
(if (<= y 2.05e-148)
(/ (fma (/ t z) 0.3333333333333333 (* y x)) y)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - ((y - (t / y)) / (3.0 * z));
double tmp;
if (y <= -3.7e-126) {
tmp = t_1;
} else if (y <= 2.05e-148) {
tmp = fma((t / z), 0.3333333333333333, (y * x)) / y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))) tmp = 0.0 if (y <= -3.7e-126) tmp = t_1; elseif (y <= 2.05e-148) tmp = Float64(fma(Float64(t / z), 0.3333333333333333, Float64(y * x)) / y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.7e-126], t$95$1, If[LessEqual[y, 2.05e-148], N[(N[(N[(t / z), $MachinePrecision] * 0.3333333333333333 + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{if}\;y \leq -3.7 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-148}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{t}{z}, 0.3333333333333333, y \cdot x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.6999999999999999e-126 or 2.0500000000000001e-148 < y Initial program 97.1%
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-/.f6498.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
if -3.6999999999999999e-126 < y < 2.0500000000000001e-148Initial program 89.8%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6497.6
Applied rewrites97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- y (/ t y))))
(if (<= y -3.7e-126)
(fma t_1 (/ -0.3333333333333333 z) x)
(if (<= y 2.05e-148)
(/ (fma (/ t z) 0.3333333333333333 (* y x)) y)
(fma (/ t_1 z) -0.3333333333333333 x)))))
double code(double x, double y, double z, double t) {
double t_1 = y - (t / y);
double tmp;
if (y <= -3.7e-126) {
tmp = fma(t_1, (-0.3333333333333333 / z), x);
} else if (y <= 2.05e-148) {
tmp = fma((t / z), 0.3333333333333333, (y * x)) / y;
} else {
tmp = fma((t_1 / z), -0.3333333333333333, x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y - Float64(t / y)) tmp = 0.0 if (y <= -3.7e-126) tmp = fma(t_1, Float64(-0.3333333333333333 / z), x); elseif (y <= 2.05e-148) tmp = Float64(fma(Float64(t / z), 0.3333333333333333, Float64(y * x)) / y); else tmp = fma(Float64(t_1 / z), -0.3333333333333333, x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.7e-126], N[(t$95$1 * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 2.05e-148], N[(N[(N[(t / z), $MachinePrecision] * 0.3333333333333333 + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(t$95$1 / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y - \frac{t}{y}\\
\mathbf{if}\;y \leq -3.7 \cdot 10^{-126}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-148}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{t}{z}, 0.3333333333333333, y \cdot x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_1}{z}, -0.3333333333333333, x\right)\\
\end{array}
\end{array}
if y < -3.6999999999999999e-126Initial program 94.3%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
associate-/r*N/A
div-subN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
associate-*r/N/A
Applied rewrites97.5%
Applied rewrites97.5%
if -3.6999999999999999e-126 < y < 2.0500000000000001e-148Initial program 89.8%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6497.6
Applied rewrites97.6%
if 2.0500000000000001e-148 < y Initial program 99.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
associate-/r*N/A
div-subN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
associate-*r/N/A
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y (* 3.0 z)))))
(if (<= y -5.8e-113)
t_1
(if (<= y 1.45e+26) (fma (/ (- t) (* z y)) -0.3333333333333333 x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (3.0 * z));
double tmp;
if (y <= -5.8e-113) {
tmp = t_1;
} else if (y <= 1.45e+26) {
tmp = fma((-t / (z * y)), -0.3333333333333333, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(3.0 * z))) tmp = 0.0 if (y <= -5.8e-113) tmp = t_1; elseif (y <= 1.45e+26) tmp = fma(Float64(Float64(-t) / Float64(z * y)), -0.3333333333333333, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e-113], t$95$1, If[LessEqual[y, 1.45e+26], N[(N[((-t) / N[(z * y), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{3 \cdot z}\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z \cdot y}, -0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.80000000000000008e-113 or 1.45e26 < y Initial program 97.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
lower-fma.f64N/A
lower-/.f6492.7
Applied rewrites92.7%
Applied rewrites92.7%
Applied rewrites92.9%
if -5.80000000000000008e-113 < y < 1.45e26Initial program 91.3%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
associate-/r*N/A
div-subN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
associate-*r/N/A
Applied rewrites89.3%
Taylor expanded in y around 0
Applied rewrites88.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (/ y (* 3.0 z))))) (if (<= y -3.85e-113) t_1 (if (<= y 4.5e-143) (/ t (* (* 3.0 y) z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (3.0 * z));
double tmp;
if (y <= -3.85e-113) {
tmp = t_1;
} else if (y <= 4.5e-143) {
tmp = t / ((3.0 * y) * z);
} else {
tmp = t_1;
}
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 = x - (y / (3.0d0 * z))
if (y <= (-3.85d-113)) then
tmp = t_1
else if (y <= 4.5d-143) then
tmp = t / ((3.0d0 * y) * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (y / (3.0 * z));
double tmp;
if (y <= -3.85e-113) {
tmp = t_1;
} else if (y <= 4.5e-143) {
tmp = t / ((3.0 * y) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / (3.0 * z)) tmp = 0 if y <= -3.85e-113: tmp = t_1 elif y <= 4.5e-143: tmp = t / ((3.0 * y) * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(3.0 * z))) tmp = 0.0 if (y <= -3.85e-113) tmp = t_1; elseif (y <= 4.5e-143) tmp = Float64(t / Float64(Float64(3.0 * y) * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / (3.0 * z)); tmp = 0.0; if (y <= -3.85e-113) tmp = t_1; elseif (y <= 4.5e-143) tmp = t / ((3.0 * y) * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.85e-113], t$95$1, If[LessEqual[y, 4.5e-143], N[(t / N[(N[(3.0 * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{3 \cdot z}\\
\mathbf{if}\;y \leq -3.85 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-143}:\\
\;\;\;\;\frac{t}{\left(3 \cdot y\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.85000000000000014e-113 or 4.5e-143 < y Initial program 98.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
lower-fma.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
Applied rewrites86.9%
Applied rewrites87.0%
if -3.85000000000000014e-113 < y < 4.5e-143Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6497.9
Applied rewrites97.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.0
Applied rewrites67.0%
Applied rewrites67.1%
Applied rewrites67.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y (* 3.0 z)))))
(if (<= y -3.85e-113)
t_1
(if (<= y 4.5e-143) (* (/ t (* z y)) 0.3333333333333333) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / (3.0 * z));
double tmp;
if (y <= -3.85e-113) {
tmp = t_1;
} else if (y <= 4.5e-143) {
tmp = (t / (z * y)) * 0.3333333333333333;
} else {
tmp = t_1;
}
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 = x - (y / (3.0d0 * z))
if (y <= (-3.85d-113)) then
tmp = t_1
else if (y <= 4.5d-143) then
tmp = (t / (z * y)) * 0.3333333333333333d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (y / (3.0 * z));
double tmp;
if (y <= -3.85e-113) {
tmp = t_1;
} else if (y <= 4.5e-143) {
tmp = (t / (z * y)) * 0.3333333333333333;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / (3.0 * z)) tmp = 0 if y <= -3.85e-113: tmp = t_1 elif y <= 4.5e-143: tmp = (t / (z * y)) * 0.3333333333333333 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / Float64(3.0 * z))) tmp = 0.0 if (y <= -3.85e-113) tmp = t_1; elseif (y <= 4.5e-143) tmp = Float64(Float64(t / Float64(z * y)) * 0.3333333333333333); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / (3.0 * z)); tmp = 0.0; if (y <= -3.85e-113) tmp = t_1; elseif (y <= 4.5e-143) tmp = (t / (z * y)) * 0.3333333333333333; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.85e-113], t$95$1, If[LessEqual[y, 4.5e-143], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{3 \cdot z}\\
\mathbf{if}\;y \leq -3.85 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-143}:\\
\;\;\;\;\frac{t}{z \cdot y} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.85000000000000014e-113 or 4.5e-143 < y Initial program 98.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
lower-fma.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
Applied rewrites86.9%
Applied rewrites87.0%
if -3.85000000000000014e-113 < y < 4.5e-143Initial program 88.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.0
Applied rewrites67.0%
(FPCore (x y z t) :precision binary64 (fma (- y (/ t y)) (/ -0.3333333333333333 z) x))
double code(double x, double y, double z, double t) {
return fma((y - (t / y)), (-0.3333333333333333 / z), x);
}
function code(x, y, z, t) return fma(Float64(y - Float64(t / y)), Float64(-0.3333333333333333 / z), x) end
code[x_, y_, z_, t_] := N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - \frac{t}{y}, \frac{-0.3333333333333333}{z}, x\right)
\end{array}
Initial program 94.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
distribute-lft-out--N/A
associate-/r*N/A
div-subN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
associate-*r/N/A
Applied rewrites94.6%
Applied rewrites94.6%
(FPCore (x y z t) :precision binary64 (- x (/ y (* 3.0 z))))
double code(double x, double y, double z, double t) {
return x - (y / (3.0 * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - (y / (3.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return x - (y / (3.0 * z));
}
def code(x, y, z, t): return x - (y / (3.0 * z))
function code(x, y, z, t) return Float64(x - Float64(y / Float64(3.0 * z))) end
function tmp = code(x, y, z, t) tmp = x - (y / (3.0 * z)); end
code[x_, y_, z_, t_] := N[(x - N[(y / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{3 \cdot z}
\end{array}
Initial program 94.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
lower-fma.f64N/A
lower-/.f6465.1
Applied rewrites65.1%
Applied rewrites65.1%
Applied rewrites65.2%
(FPCore (x y z t) :precision binary64 (fma (/ -0.3333333333333333 z) y x))
double code(double x, double y, double z, double t) {
return fma((-0.3333333333333333 / z), y, x);
}
function code(x, y, z, t) return fma(Float64(-0.3333333333333333 / z), y, x) end
code[x_, y_, z_, t_] := N[(N[(-0.3333333333333333 / z), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{-0.3333333333333333}{z}, y, x\right)
\end{array}
Initial program 94.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
lower-fma.f64N/A
lower-/.f6465.1
Applied rewrites65.1%
Applied rewrites65.1%
Applied rewrites65.1%
(FPCore (x y z t) :precision binary64 (fma -0.3333333333333333 (/ y z) x))
double code(double x, double y, double z, double t) {
return fma(-0.3333333333333333, (y / z), x);
}
function code(x, y, z, t) return fma(-0.3333333333333333, Float64(y / z), x) end
code[x_, y_, z_, t_] := N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)
\end{array}
Initial program 94.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
lower-fma.f64N/A
lower-/.f6465.1
Applied rewrites65.1%
(FPCore (x y z t) :precision binary64 (/ y (* -3.0 z)))
double code(double x, double y, double z, double t) {
return y / (-3.0 * z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y / ((-3.0d0) * z)
end function
public static double code(double x, double y, double z, double t) {
return y / (-3.0 * z);
}
def code(x, y, z, t): return y / (-3.0 * z)
function code(x, y, z, t) return Float64(y / Float64(-3.0 * z)) end
function tmp = code(x, y, z, t) tmp = y / (-3.0 * z); end
code[x_, y_, z_, t_] := N[(y / N[(-3.0 * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{-3 \cdot z}
\end{array}
Initial program 94.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
lower-fma.f64N/A
lower-/.f6465.1
Applied rewrites65.1%
Applied rewrites65.1%
Taylor expanded in x around 0
Applied rewrites36.1%
Applied rewrites36.2%
(FPCore (x y z t) :precision binary64 (* (/ -0.3333333333333333 z) y))
double code(double x, double y, double z, double t) {
return (-0.3333333333333333 / z) * y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((-0.3333333333333333d0) / z) * y
end function
public static double code(double x, double y, double z, double t) {
return (-0.3333333333333333 / z) * y;
}
def code(x, y, z, t): return (-0.3333333333333333 / z) * y
function code(x, y, z, t) return Float64(Float64(-0.3333333333333333 / z) * y) end
function tmp = code(x, y, z, t) tmp = (-0.3333333333333333 / z) * y; end
code[x_, y_, z_, t_] := N[(N[(-0.3333333333333333 / z), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.3333333333333333}{z} \cdot y
\end{array}
Initial program 94.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
lower-fma.f64N/A
lower-/.f6465.1
Applied rewrites65.1%
Applied rewrites65.1%
Taylor expanded in x around 0
Applied rewrites36.1%
Applied rewrites36.2%
(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 2024332
(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))))