
(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 12 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 (or (<= y -5e-90) (not (<= y 3e-65))) (- x (/ (- y (/ t y)) (* 3.0 z))) (fma (/ 0.3333333333333333 y) (/ t z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e-90) || !(y <= 3e-65)) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = fma((0.3333333333333333 / y), (t / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -5e-90) || !(y <= 3e-65)) tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); else tmp = fma(Float64(0.3333333333333333 / y), Float64(t / z), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5e-90], N[Not[LessEqual[y, 3e-65]], $MachinePrecision]], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 / y), $MachinePrecision] * N[(t / z), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-90} \lor \neg \left(y \leq 3 \cdot 10^{-65}\right):\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{0.3333333333333333}{y}, \frac{t}{z}, x\right)\\
\end{array}
\end{array}
if y < -5.00000000000000019e-90 or 2.99999999999999998e-65 < y Initial program 98.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
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if -5.00000000000000019e-90 < y < 2.99999999999999998e-65Initial program 88.2%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
*-inversesN/A
*-rgt-identityN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (<= t 9e+59)
(+ (- x (/ y (* z 3.0))) (/ (/ t (* 3.0 z)) y))
(-
x
(* (/ (fma (/ 0.3333333333333333 t) y (/ -0.3333333333333333 y)) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9e+59) {
tmp = (x - (y / (z * 3.0))) + ((t / (3.0 * z)) / y);
} else {
tmp = x - ((fma((0.3333333333333333 / t), y, (-0.3333333333333333 / y)) / z) * t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 9e+59) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(3.0 * z)) / y)); else tmp = Float64(x - Float64(Float64(fma(Float64(0.3333333333333333 / t), y, Float64(-0.3333333333333333 / y)) / z) * t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 9e+59], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(3.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(N[(0.3333333333333333 / t), $MachinePrecision] * y + N[(-0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9 \cdot 10^{+59}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{3 \cdot z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(\frac{0.3333333333333333}{t}, y, \frac{-0.3333333333333333}{y}\right)}{z} \cdot t\\
\end{array}
\end{array}
if t < 8.99999999999999919e59Initial program 94.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
if 8.99999999999999919e59 < t Initial program 98.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-/.f6488.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r/N/A
times-fracN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/r*N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(if (<= t 5e+72)
(- x (/ (- y (/ t y)) (* 3.0 z)))
(-
x
(* (/ (fma (/ 0.3333333333333333 t) y (/ -0.3333333333333333 y)) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 5e+72) {
tmp = x - ((y - (t / y)) / (3.0 * z));
} else {
tmp = x - ((fma((0.3333333333333333 / t), y, (-0.3333333333333333 / y)) / z) * t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 5e+72) tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); else tmp = Float64(x - Float64(Float64(fma(Float64(0.3333333333333333 / t), y, Float64(-0.3333333333333333 / y)) / z) * t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 5e+72], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(N[(0.3333333333333333 / t), $MachinePrecision] * y + N[(-0.3333333333333333 / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5 \cdot 10^{+72}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(\frac{0.3333333333333333}{t}, y, \frac{-0.3333333333333333}{y}\right)}{z} \cdot t\\
\end{array}
\end{array}
if t < 4.99999999999999992e72Initial program 94.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-/.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
if 4.99999999999999992e72 < t Initial program 97.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-/.f6486.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.5
Applied rewrites86.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-*r/N/A
times-fracN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/r*N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y z t) :precision binary64 (if (<= z -5e+101) (+ (- x (/ y (* z 3.0))) (/ t (* (* 3.0 y) z))) (- x (/ (- y (/ t y)) (* 3.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+101) {
tmp = (x - (y / (z * 3.0))) + (t / ((3.0 * y) * z));
} else {
tmp = x - ((y - (t / y)) / (3.0 * z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5d+101)) then
tmp = (x - (y / (z * 3.0d0))) + (t / ((3.0d0 * y) * z))
else
tmp = x - ((y - (t / y)) / (3.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+101) {
tmp = (x - (y / (z * 3.0))) + (t / ((3.0 * y) * z));
} else {
tmp = x - ((y - (t / y)) / (3.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5e+101: tmp = (x - (y / (z * 3.0))) + (t / ((3.0 * y) * z)) else: tmp = x - ((y - (t / y)) / (3.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5e+101) tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(3.0 * y) * z))); else tmp = Float64(x - Float64(Float64(y - Float64(t / y)) / Float64(3.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5e+101) tmp = (x - (y / (z * 3.0))) + (t / ((3.0 * y) * z)); else tmp = x - ((y - (t / y)) / (3.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5e+101], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(3.0 * y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+101}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(3 \cdot y\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - \frac{t}{y}}{3 \cdot z}\\
\end{array}
\end{array}
if z < -4.99999999999999989e101Initial program 98.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6498.3
Applied rewrites98.3%
if -4.99999999999999989e101 < z Initial program 93.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-/.f6498.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -410000000.0)
(- x (/ (* 0.3333333333333333 y) z))
(if (<= y 4.7e-20)
(fma (/ 0.3333333333333333 y) (/ t z) x)
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -410000000.0) {
tmp = x - ((0.3333333333333333 * y) / z);
} else if (y <= 4.7e-20) {
tmp = fma((0.3333333333333333 / y), (t / z), x);
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -410000000.0) tmp = Float64(x - Float64(Float64(0.3333333333333333 * y) / z)); elseif (y <= 4.7e-20) tmp = fma(Float64(0.3333333333333333 / y), Float64(t / z), x); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -410000000.0], N[(x - N[(N[(0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.7e-20], N[(N[(0.3333333333333333 / y), $MachinePrecision] * N[(t / z), $MachinePrecision] + x), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -410000000:\\
\;\;\;\;x - \frac{0.3333333333333333 \cdot y}{z}\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(\frac{0.3333333333333333}{y}, \frac{t}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -4.1e8Initial program 98.3%
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%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
lower-*.f6495.2
Applied rewrites95.2%
if -4.1e8 < y < 4.70000000000000015e-20Initial program 90.8%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
*-inversesN/A
*-rgt-identityN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
if 4.70000000000000015e-20 < y Initial program 98.5%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -410000000.0)
(- x (/ (* 0.3333333333333333 y) z))
(if (<= y 2.5e+34)
(fma 0.3333333333333333 (/ t (* z y)) x)
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -410000000.0) {
tmp = x - ((0.3333333333333333 * y) / z);
} else if (y <= 2.5e+34) {
tmp = fma(0.3333333333333333, (t / (z * y)), x);
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -410000000.0) tmp = Float64(x - Float64(Float64(0.3333333333333333 * y) / z)); elseif (y <= 2.5e+34) tmp = fma(0.3333333333333333, Float64(t / Float64(z * y)), x); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -410000000.0], N[(x - N[(N[(0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+34], N[(0.3333333333333333 * N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -410000000:\\
\;\;\;\;x - \frac{0.3333333333333333 \cdot y}{z}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{t}{z \cdot y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -4.1e8Initial program 98.3%
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%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
lower-*.f6495.2
Applied rewrites95.2%
if -4.1e8 < y < 2.4999999999999999e34Initial program 91.6%
Taylor expanded in y around 0
div-addN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/l*N/A
fp-cancel-sign-sub-invN/A
*-inversesN/A
*-rgt-identityN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
associate-*r/N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
Applied rewrites87.2%
if 2.4999999999999999e34 < y Initial program 98.4%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6495.0
Applied rewrites95.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -6.3e-7)
(- x (/ (* 0.3333333333333333 y) z))
(if (<= y 4.2e-20)
(/ (* 0.3333333333333333 t) (* z y))
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.3e-7) {
tmp = x - ((0.3333333333333333 * y) / z);
} else if (y <= 4.2e-20) {
tmp = (0.3333333333333333 * t) / (z * y);
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -6.3e-7) tmp = Float64(x - Float64(Float64(0.3333333333333333 * y) / z)); elseif (y <= 4.2e-20) tmp = Float64(Float64(0.3333333333333333 * t) / Float64(z * y)); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.3e-7], N[(x - N[(N[(0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e-20], N[(N[(0.3333333333333333 * t), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.3 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{0.3333333333333333 \cdot y}{z}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-20}:\\
\;\;\;\;\frac{0.3333333333333333 \cdot t}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -6.30000000000000003e-7Initial program 98.3%
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%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
lower-*.f6493.9
Applied rewrites93.9%
if -6.30000000000000003e-7 < y < 4.1999999999999998e-20Initial program 90.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.8
Applied rewrites58.8%
Applied rewrites58.8%
if 4.1999999999999998e-20 < y Initial program 98.5%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -6.3e-7)
(- x (/ (* 0.3333333333333333 y) z))
(if (<= y 4.2e-20)
(* (/ t (* z y)) 0.3333333333333333)
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.3e-7) {
tmp = x - ((0.3333333333333333 * y) / z);
} else if (y <= 4.2e-20) {
tmp = (t / (z * y)) * 0.3333333333333333;
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -6.3e-7) tmp = Float64(x - Float64(Float64(0.3333333333333333 * y) / z)); elseif (y <= 4.2e-20) tmp = Float64(Float64(t / Float64(z * y)) * 0.3333333333333333); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.3e-7], N[(x - N[(N[(0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e-20], N[(N[(t / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.3 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{0.3333333333333333 \cdot y}{z}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-20}:\\
\;\;\;\;\frac{t}{z \cdot y} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -6.30000000000000003e-7Initial program 98.3%
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%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
lower-*.f6493.9
Applied rewrites93.9%
if -6.30000000000000003e-7 < y < 4.1999999999999998e-20Initial program 90.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.8
Applied rewrites58.8%
if 4.1999999999999998e-20 < y Initial program 98.5%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -6.3e-7)
(- x (/ (* 0.3333333333333333 y) z))
(if (<= y 4.2e-20)
(* t (/ 0.3333333333333333 (* z y)))
(fma -0.3333333333333333 (/ y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.3e-7) {
tmp = x - ((0.3333333333333333 * y) / z);
} else if (y <= 4.2e-20) {
tmp = t * (0.3333333333333333 / (z * y));
} else {
tmp = fma(-0.3333333333333333, (y / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -6.3e-7) tmp = Float64(x - Float64(Float64(0.3333333333333333 * y) / z)); elseif (y <= 4.2e-20) tmp = Float64(t * Float64(0.3333333333333333 / Float64(z * y))); else tmp = fma(-0.3333333333333333, Float64(y / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.3e-7], N[(x - N[(N[(0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e-20], N[(t * N[(0.3333333333333333 / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.3 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{0.3333333333333333 \cdot y}{z}\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-20}:\\
\;\;\;\;t \cdot \frac{0.3333333333333333}{z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, \frac{y}{z}, x\right)\\
\end{array}
\end{array}
if y < -6.30000000000000003e-7Initial program 98.3%
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%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around inf
lower-*.f6493.9
Applied rewrites93.9%
if -6.30000000000000003e-7 < y < 4.1999999999999998e-20Initial program 90.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.8
Applied rewrites58.8%
Applied rewrites58.4%
if 4.1999999999999998e-20 < y Initial program 98.5%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
(FPCore (x y z t) :precision binary64 (- x (/ (* 0.3333333333333333 y) z)))
double code(double x, double y, double z, double t) {
return x - ((0.3333333333333333 * y) / z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((0.3333333333333333d0 * y) / z)
end function
public static double code(double x, double y, double z, double t) {
return x - ((0.3333333333333333 * y) / z);
}
def code(x, y, z, t): return x - ((0.3333333333333333 * y) / z)
function code(x, y, z, t) return Float64(x - Float64(Float64(0.3333333333333333 * y) / z)) end
function tmp = code(x, y, z, t) tmp = x - ((0.3333333333333333 * y) / z); end
code[x_, y_, z_, t_] := N[(x - N[(N[(0.3333333333333333 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{0.3333333333333333 \cdot y}{z}
\end{array}
Initial program 94.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-/.f6496.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Taylor expanded in y around inf
lower-*.f6466.0
Applied rewrites66.0%
(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.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6466.0
Applied rewrites66.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 94.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
fp-cancel-sign-subN/A
distribute-lft-neg-inN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
*-inversesN/A
*-rgt-identityN/A
*-lft-identityN/A
distribute-lft-neg-inN/A
fp-cancel-sign-sub-invN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6466.0
Applied rewrites66.0%
Applied rewrites66.0%
Taylor expanded in x around 0
Applied rewrites35.9%
Applied rewrites35.9%
(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y)))
double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
}
def code(x, y, z, t): return (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y)) end
function tmp = code(x, y, z, t) tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y); end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}
\end{array}
herbie shell --seed 2024337
(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))))