
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-neg.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))) (t_1 (* z (sin y))) (t_2 (- t_0 t_1)))
(if (<= t_2 -1e+17)
(fma (sin y) (- z) (+ 1.0 x))
(if (<= t_2 0.9999999999999775) (/ 1.0 (/ 1.0 t_0)) (- (+ 1.0 x) t_1)))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = z * sin(y);
double t_2 = t_0 - t_1;
double tmp;
if (t_2 <= -1e+17) {
tmp = fma(sin(y), -z, (1.0 + x));
} else if (t_2 <= 0.9999999999999775) {
tmp = 1.0 / (1.0 / t_0);
} else {
tmp = (1.0 + x) - t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(z * sin(y)) t_2 = Float64(t_0 - t_1) tmp = 0.0 if (t_2 <= -1e+17) tmp = fma(sin(y), Float64(-z), Float64(1.0 + x)); elseif (t_2 <= 0.9999999999999775) tmp = Float64(1.0 / Float64(1.0 / t_0)); else tmp = Float64(Float64(1.0 + x) - t_1); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+17], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.9999999999999775], N[(1.0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\mathbf{elif}\;t\_2 \leq 0.9999999999999775:\\
\;\;\;\;\frac{1}{\frac{1}{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x\right) - t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e17Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
lift--.f64N/A
lift-*.f64N/A
cancel-sub-sign-invN/A
lift-sin.f64N/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
if -1e17 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.999999999999977462Initial program 100.0%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.5
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.5%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6499.0
Applied rewrites99.0%
if 0.999999999999977462 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -1.3e-151)
(- (+ 1.0 x) (* z (sin y)))
(if (<= z 2.6e-47)
(- (+ x (cos y)) (* z y))
(fma (sin y) (- z) (+ 1.0 x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e-151) {
tmp = (1.0 + x) - (z * sin(y));
} else if (z <= 2.6e-47) {
tmp = (x + cos(y)) - (z * y);
} else {
tmp = fma(sin(y), -z, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.3e-151) tmp = Float64(Float64(1.0 + x) - Float64(z * sin(y))); elseif (z <= 2.6e-47) tmp = Float64(Float64(x + cos(y)) - Float64(z * y)); else tmp = fma(sin(y), Float64(-z), Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.3e-151], N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e-47], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-151}:\\
\;\;\;\;\left(1 + x\right) - z \cdot \sin y\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-47}:\\
\;\;\;\;\left(x + \cos y\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\end{array}
\end{array}
if z < -1.3e-151Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites93.8%
if -1.3e-151 < z < 2.6e-47Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6492.3
Applied rewrites92.3%
if 2.6e-47 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites97.5%
lift--.f64N/A
lift-*.f64N/A
cancel-sub-sign-invN/A
lift-sin.f64N/A
+-commutativeN/A
lift-sin.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6497.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.5
Applied rewrites97.5%
Final simplification94.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (+ 1.0 x) (* z (sin y)))))
(if (<= z -1.3e-151)
t_0
(if (<= z 2.6e-47) (- (+ x (cos y)) (* z y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (1.0 + x) - (z * sin(y));
double tmp;
if (z <= -1.3e-151) {
tmp = t_0;
} else if (z <= 2.6e-47) {
tmp = (x + cos(y)) - (z * y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + x) - (z * sin(y))
if (z <= (-1.3d-151)) then
tmp = t_0
else if (z <= 2.6d-47) then
tmp = (x + cos(y)) - (z * y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (1.0 + x) - (z * Math.sin(y));
double tmp;
if (z <= -1.3e-151) {
tmp = t_0;
} else if (z <= 2.6e-47) {
tmp = (x + Math.cos(y)) - (z * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 + x) - (z * math.sin(y)) tmp = 0 if z <= -1.3e-151: tmp = t_0 elif z <= 2.6e-47: tmp = (x + math.cos(y)) - (z * y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 + x) - Float64(z * sin(y))) tmp = 0.0 if (z <= -1.3e-151) tmp = t_0; elseif (z <= 2.6e-47) tmp = Float64(Float64(x + cos(y)) - Float64(z * y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 + x) - (z * sin(y)); tmp = 0.0; if (z <= -1.3e-151) tmp = t_0; elseif (z <= 2.6e-47) tmp = (x + cos(y)) - (z * y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-151], t$95$0, If[LessEqual[z, 2.6e-47], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + x\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-47}:\\
\;\;\;\;\left(x + \cos y\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.3e-151 or 2.6e-47 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites95.5%
if -1.3e-151 < z < 2.6e-47Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6492.3
Applied rewrites92.3%
Final simplification94.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- z) (sin y))))
(if (<= z -7.5e+148)
t_0
(if (<= z 4.8e+70)
(-
x
(fma y (/ 1.0 (fma (/ (* (/ y z) 0.25) (* z z)) y (/ 1.0 z))) -1.0))
t_0))))
double code(double x, double y, double z) {
double t_0 = -z * sin(y);
double tmp;
if (z <= -7.5e+148) {
tmp = t_0;
} else if (z <= 4.8e+70) {
tmp = x - fma(y, (1.0 / fma((((y / z) * 0.25) / (z * z)), y, (1.0 / z))), -1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(-z) * sin(y)) tmp = 0.0 if (z <= -7.5e+148) tmp = t_0; elseif (z <= 4.8e+70) tmp = Float64(x - fma(y, Float64(1.0 / fma(Float64(Float64(Float64(y / z) * 0.25) / Float64(z * z)), y, Float64(1.0 / z))), -1.0)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+148], t$95$0, If[LessEqual[z, 4.8e+70], N[(x - N[(y * N[(1.0 / N[(N[(N[(N[(y / z), $MachinePrecision] * 0.25), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] * y + N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) \cdot \sin y\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+70}:\\
\;\;\;\;x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.50000000000000008e148 or 4.79999999999999974e70 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6468.5
Applied rewrites68.5%
if -7.50000000000000008e148 < z < 4.79999999999999974e70Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
cancel-sign-sub-invN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
Applied rewrites62.8%
Applied rewrites62.8%
Taylor expanded in y around 0
Applied rewrites78.4%
Taylor expanded in y around inf
Applied rewrites78.4%
(FPCore (x y z) :precision binary64 (- (+ 1.0 x) (* z (sin y))))
double code(double x, double y, double z) {
return (1.0 + x) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 + x) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (1.0 + x) - (z * Math.sin(y));
}
def code(x, y, z): return (1.0 + x) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(1.0 + x) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (1.0 + x) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + x\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites86.9%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (- x (fma y (/ 1.0 (fma (/ (* (/ y z) 0.25) (* z z)) y (/ 1.0 z))) -1.0)))
double code(double x, double y, double z) {
return x - fma(y, (1.0 / fma((((y / z) * 0.25) / (z * z)), y, (1.0 / z))), -1.0);
}
function code(x, y, z) return Float64(x - fma(y, Float64(1.0 / fma(Float64(Float64(Float64(y / z) * 0.25) / Float64(z * z)), y, Float64(1.0 / z))), -1.0)) end
code[x_, y_, z_] := N[(x - N[(y * N[(1.0 / N[(N[(N[(N[(y / z), $MachinePrecision] * 0.25), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision] * y + N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \mathsf{fma}\left(y, \frac{1}{\mathsf{fma}\left(\frac{\frac{y}{z} \cdot 0.25}{z \cdot z}, y, \frac{1}{z}\right)}, -1\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
cancel-sign-sub-invN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
Applied rewrites58.6%
Applied rewrites48.2%
Taylor expanded in y around 0
Applied rewrites69.9%
Taylor expanded in y around inf
Applied rewrites69.9%
(FPCore (x y z) :precision binary64 (if (<= y -2.95e+23) (+ 1.0 x) (if (<= y 1e+18) (- x (fma y (fma 0.5 y z) -1.0)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.95e+23) {
tmp = 1.0 + x;
} else if (y <= 1e+18) {
tmp = x - fma(y, fma(0.5, y, z), -1.0);
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2.95e+23) tmp = Float64(1.0 + x); elseif (y <= 1e+18) tmp = Float64(x - fma(y, fma(0.5, y, z), -1.0)); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2.95e+23], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 1e+18], N[(x - N[(y * N[(0.5 * y + z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{+23}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 10^{+18}:\\
\;\;\;\;x - \mathsf{fma}\left(y, \mathsf{fma}\left(0.5, y, z\right), -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -2.94999999999999994e23 or 1e18 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6442.6
Applied rewrites42.6%
if -2.94999999999999994e23 < y < 1e18Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
cancel-sign-sub-invN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
Applied rewrites96.1%
(FPCore (x y z) :precision binary64 (if (<= y -2.15e+77) (+ 1.0 x) (if (<= y 1.25e+18) (- x (fma z y -1.0)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.15e+77) {
tmp = 1.0 + x;
} else if (y <= 1.25e+18) {
tmp = x - fma(z, y, -1.0);
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2.15e+77) tmp = Float64(1.0 + x); elseif (y <= 1.25e+18) tmp = Float64(x - fma(z, y, -1.0)); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2.15e+77], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 1.25e+18], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+77}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+18}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -2.14999999999999996e77 or 1.25e18 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6443.3
Applied rewrites43.3%
if -2.14999999999999996e77 < y < 1.25e18Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
cancel-sign-sub-invN/A
associate-+l-N/A
lower--.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
remove-double-negN/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6491.6
Applied rewrites91.6%
(FPCore (x y z) :precision binary64 (if (<= z 1e+170) (+ 1.0 x) (- x (* z y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1e+170) {
tmp = 1.0 + x;
} else {
tmp = x - (z * y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1d+170) then
tmp = 1.0d0 + x
else
tmp = x - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1e+170) {
tmp = 1.0 + x;
} else {
tmp = x - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1e+170: tmp = 1.0 + x else: tmp = x - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1e+170) tmp = Float64(1.0 + x); else tmp = Float64(x - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1e+170) tmp = 1.0 + x; else tmp = x - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1e+170], N[(1.0 + x), $MachinePrecision], N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 10^{+170}:\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot y\\
\end{array}
\end{array}
if z < 1.00000000000000003e170Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6467.4
Applied rewrites67.4%
if 1.00000000000000003e170 < z Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
cancel-sign-sub-invN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
Applied rewrites69.5%
Taylor expanded in y around inf
Applied rewrites26.1%
Taylor expanded in z around inf
Applied rewrites67.2%
Final simplification67.3%
(FPCore (x y z) :precision binary64 (if (<= z 1.05e+230) (+ 1.0 x) (* (- y) z)))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.05e+230) {
tmp = 1.0 + x;
} else {
tmp = -y * z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 1.05d+230) then
tmp = 1.0d0 + x
else
tmp = -y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.05e+230) {
tmp = 1.0 + x;
} else {
tmp = -y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.05e+230: tmp = 1.0 + x else: tmp = -y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.05e+230) tmp = Float64(1.0 + x); else tmp = Float64(Float64(-y) * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.05e+230) tmp = 1.0 + x; else tmp = -y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.05e+230], N[(1.0 + x), $MachinePrecision], N[((-y) * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.05 \cdot 10^{+230}:\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\end{array}
\end{array}
if z < 1.04999999999999996e230Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6467.1
Applied rewrites67.1%
if 1.04999999999999996e230 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6483.2
Applied rewrites83.2%
Taylor expanded in y around 0
Applied rewrites46.2%
(FPCore (x y z) :precision binary64 (+ 1.0 x))
double code(double x, double y, double z) {
return 1.0 + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + x
end function
public static double code(double x, double y, double z) {
return 1.0 + x;
}
def code(x, y, z): return 1.0 + x
function code(x, y, z) return Float64(1.0 + x) end
function tmp = code(x, y, z) tmp = 1.0 + x; end
code[x_, y_, z_] := N[(1.0 + x), $MachinePrecision]
\begin{array}{l}
\\
1 + x
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6463.7
Applied rewrites63.7%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6463.7
Applied rewrites63.7%
Taylor expanded in x around 0
Applied rewrites23.4%
herbie shell --seed 2024298
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))