
(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 14 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 (<= t 4e+20) (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)) (fma (/ 1.0 (* y (* z 3.0))) t (fma (/ y z) -0.3333333333333333 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 4e+20) {
tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
} else {
tmp = fma((1.0 / (y * (z * 3.0))), t, fma((y / z), -0.3333333333333333, x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 4e+20) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)); else tmp = fma(Float64(1.0 / Float64(y * Float64(z * 3.0))), t, fma(Float64(y / z), -0.3333333333333333, x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 4e+20], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t + N[(N[(y / z), $MachinePrecision] * -0.3333333333333333 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4 \cdot 10^{+20}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{y \cdot \left(z \cdot 3\right)}, t, \mathsf{fma}\left(\frac{y}{z}, -0.3333333333333333, x\right)\right)\\
\end{array}
\end{array}
if t < 4e20Initial program 96.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if 4e20 < t Initial program 93.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-invN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
metadata-evalN/A
metadata-eval98.1
Applied rewrites98.1%
(FPCore (x y z t) :precision binary64 (fma (/ (- (/ t y) y) 3.0) (/ 1.0 z) x))
double code(double x, double y, double z, double t) {
return fma((((t / y) - y) / 3.0), (1.0 / z), x);
}
function code(x, y, z, t) return fma(Float64(Float64(Float64(t / y) - y) / 3.0), Float64(1.0 / z), x) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(t / y), $MachinePrecision] - y), $MachinePrecision] / 3.0), $MachinePrecision] * N[(1.0 / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{\frac{t}{y} - y}{3}, \frac{1}{z}, x\right)
\end{array}
Initial program 95.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-/.f6497.6
Applied rewrites97.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
Applied rewrites97.6%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.6e+59)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 3.8e+50)
(fma (/ t z) (/ 0.3333333333333333 y) x)
(fma -0.3333333333333333 (* y (/ 1.0 z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.6e+59) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 3.8e+50) {
tmp = fma((t / z), (0.3333333333333333 / y), x);
} else {
tmp = fma(-0.3333333333333333, (y * (1.0 / z)), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.6e+59) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 3.8e+50) tmp = fma(Float64(t / z), Float64(0.3333333333333333 / y), x); else tmp = fma(-0.3333333333333333, Float64(y * Float64(1.0 / z)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.6e+59], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 3.8e+50], N[(N[(t / z), $MachinePrecision] * N[(0.3333333333333333 / y), $MachinePrecision] + x), $MachinePrecision], N[(-0.3333333333333333 * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z}, \frac{0.3333333333333333}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, y \cdot \frac{1}{z}, x\right)\\
\end{array}
\end{array}
if y < -2.59999999999999999e59Initial program 96.9%
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.0%
if -2.59999999999999999e59 < y < 3.79999999999999987e50Initial program 95.0%
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.5
Applied rewrites95.5%
Taylor expanded in y around 0
div-subN/A
*-commutativeN/A
associate-/l*N/A
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites88.8%
Applied rewrites94.2%
if 3.79999999999999987e50 < y Initial program 96.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-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites99.7%
Applied rewrites99.7%
Final simplification96.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.5e+59)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 3.8e+50)
(+ x (/ t (* y (* z 3.0))))
(fma -0.3333333333333333 (* y (/ 1.0 z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e+59) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 3.8e+50) {
tmp = x + (t / (y * (z * 3.0)));
} else {
tmp = fma(-0.3333333333333333, (y * (1.0 / z)), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.5e+59) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 3.8e+50) tmp = Float64(x + Float64(t / Float64(y * Float64(z * 3.0)))); else tmp = fma(-0.3333333333333333, Float64(y * Float64(1.0 / z)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e+59], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 3.8e+50], N[(x + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+50}:\\
\;\;\;\;x + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, y \cdot \frac{1}{z}, x\right)\\
\end{array}
\end{array}
if y < -2.4999999999999999e59Initial program 96.9%
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.0%
if -2.4999999999999999e59 < y < 3.79999999999999987e50Initial program 95.0%
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.5
Applied rewrites95.5%
Taylor expanded in y around 0
div-subN/A
*-commutativeN/A
associate-/l*N/A
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites88.8%
Applied rewrites89.6%
if 3.79999999999999987e50 < y Initial program 96.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-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites99.7%
Applied rewrites99.7%
Final simplification93.6%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.5e+59)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 3.8e+50)
(fma (/ t (* y z)) 0.3333333333333333 x)
(fma -0.3333333333333333 (* y (/ 1.0 z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e+59) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 3.8e+50) {
tmp = fma((t / (y * z)), 0.3333333333333333, x);
} else {
tmp = fma(-0.3333333333333333, (y * (1.0 / z)), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.5e+59) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 3.8e+50) tmp = fma(Float64(t / Float64(y * z)), 0.3333333333333333, x); else tmp = fma(-0.3333333333333333, Float64(y * Float64(1.0 / z)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e+59], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 3.8e+50], N[(N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + x), $MachinePrecision], N[(-0.3333333333333333 * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y \cdot z}, 0.3333333333333333, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, y \cdot \frac{1}{z}, x\right)\\
\end{array}
\end{array}
if y < -2.4999999999999999e59Initial program 96.9%
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.0%
if -2.4999999999999999e59 < y < 3.79999999999999987e50Initial program 95.0%
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.5
Applied rewrites95.5%
Taylor expanded in y around 0
div-subN/A
*-commutativeN/A
associate-/l*N/A
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites88.8%
Applied rewrites89.5%
if 3.79999999999999987e50 < y Initial program 96.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-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites99.7%
Applied rewrites99.7%
Final simplification93.6%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.5e+59)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 3.8e+50)
(fma t (/ 0.3333333333333333 (* y z)) x)
(fma -0.3333333333333333 (* y (/ 1.0 z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e+59) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 3.8e+50) {
tmp = fma(t, (0.3333333333333333 / (y * z)), x);
} else {
tmp = fma(-0.3333333333333333, (y * (1.0 / z)), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.5e+59) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 3.8e+50) tmp = fma(t, Float64(0.3333333333333333 / Float64(y * z)), x); else tmp = fma(-0.3333333333333333, Float64(y * Float64(1.0 / z)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e+59], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 3.8e+50], N[(t * N[(0.3333333333333333 / N[(y * z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(-0.3333333333333333 * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{0.3333333333333333}{y \cdot z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, y \cdot \frac{1}{z}, x\right)\\
\end{array}
\end{array}
if y < -2.4999999999999999e59Initial program 96.9%
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.0%
if -2.4999999999999999e59 < y < 3.79999999999999987e50Initial program 95.0%
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.5
Applied rewrites95.5%
Taylor expanded in y around 0
div-subN/A
*-commutativeN/A
associate-/l*N/A
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-outN/A
remove-double-negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites88.8%
if 3.79999999999999987e50 < y Initial program 96.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-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites99.7%
Applied rewrites99.7%
Final simplification93.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.7e-16)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 8.8e-55)
(/ t (* y (* z 3.0)))
(fma -0.3333333333333333 (* y (/ 1.0 z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e-16) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 8.8e-55) {
tmp = t / (y * (z * 3.0));
} else {
tmp = fma(-0.3333333333333333, (y * (1.0 / z)), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.7e-16) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 8.8e-55) tmp = Float64(t / Float64(y * Float64(z * 3.0))); else tmp = fma(-0.3333333333333333, Float64(y * Float64(1.0 / z)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e-16], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 8.8e-55], N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y * N[(1.0 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-55}:\\
\;\;\;\;\frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, y \cdot \frac{1}{z}, x\right)\\
\end{array}
\end{array}
if y < -1.7e-16Initial program 97.4%
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 rewrites91.7%
if -1.7e-16 < y < 8.7999999999999998e-55Initial program 93.8%
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-/.f6494.5
Applied rewrites94.5%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites28.7%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.0
Applied rewrites66.0%
Applied rewrites66.1%
if 8.7999999999999998e-55 < y Initial program 96.9%
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
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites92.7%
Applied rewrites92.7%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.7e-16)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 8.8e-55)
(/ t (* y (* z 3.0)))
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e-16) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 8.8e-55) {
tmp = t / (y * (z * 3.0));
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.7e-16) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 8.8e-55) tmp = Float64(t / Float64(y * Float64(z * 3.0))); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e-16], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 8.8e-55], N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-55}:\\
\;\;\;\;\frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -1.7e-16Initial program 97.4%
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 rewrites91.7%
if -1.7e-16 < y < 8.7999999999999998e-55Initial program 93.8%
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-/.f6494.5
Applied rewrites94.5%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites28.7%
Taylor expanded in y around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6466.0
Applied rewrites66.0%
Applied rewrites66.1%
if 8.7999999999999998e-55 < y Initial program 96.9%
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
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites92.7%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -7.5e-25)
(fma y (/ -0.3333333333333333 z) x)
(if (<= y 8.8e-55)
(/ (* t 0.3333333333333333) (* y z))
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.5e-25) {
tmp = fma(y, (-0.3333333333333333 / z), x);
} else if (y <= 8.8e-55) {
tmp = (t * 0.3333333333333333) / (y * z);
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -7.5e-25) tmp = fma(y, Float64(-0.3333333333333333 / z), x); elseif (y <= 8.8e-55) tmp = Float64(Float64(t * 0.3333333333333333) / Float64(y * z)); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.5e-25], N[(y * N[(-0.3333333333333333 / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 8.8e-55], N[(N[(t * 0.3333333333333333), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-0.3333333333333333}{z}, x\right)\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-55}:\\
\;\;\;\;\frac{t \cdot 0.3333333333333333}{y \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -7.49999999999999989e-25Initial program 97.6%
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 rewrites88.9%
if -7.49999999999999989e-25 < y < 8.7999999999999998e-55Initial program 93.5%
Taylor expanded in y around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6466.8
Applied rewrites66.8%
if 8.7999999999999998e-55 < y Initial program 96.9%
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
Applied rewrites99.9%
Taylor expanded in y around inf
sub-negN/A
distribute-rgt-inN/A
remove-double-negN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
unsub-negN/A
neg-sub0N/A
associate--r+N/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Applied rewrites92.7%
Final simplification81.0%
(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.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-/.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.7%
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.4
Applied rewrites97.4%
(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.7%
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 rewrites65.1%
(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.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-/.f6439.1
Applied rewrites39.1%
Applied rewrites39.2%
(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.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-/.f6439.1
Applied rewrites39.1%
(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 2024232
(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))))