
(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 17 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 (let* ((t_0 (+ x (fma z (sin y) (cos y))))) (* t_0 (/ (+ x (- (cos y) (* z (sin y)))) t_0))))
double code(double x, double y, double z) {
double t_0 = x + fma(z, sin(y), cos(y));
return t_0 * ((x + (cos(y) - (z * sin(y)))) / t_0);
}
function code(x, y, z) t_0 = Float64(x + fma(z, sin(y), cos(y))) return Float64(t_0 * Float64(Float64(x + Float64(cos(y) - Float64(z * sin(y)))) / t_0)) end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[Sin[y], $MachinePrecision] + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(N[(x + N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \mathsf{fma}\left(z, \sin y, \cos y\right)\\
t\_0 \cdot \frac{x + \left(\cos y - z \cdot \sin y\right)}{t\_0}
\end{array}
\end{array}
Initial program 99.9%
lift--.f64N/A
flip--N/A
difference-of-squaresN/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y)))
(t_1 (* z (sin y)))
(t_2 (- t_0 t_1))
(t_3 (+ x (- t_1))))
(if (<= t_2 -40000000000.0) t_3 (if (<= t_2 5e+15) t_0 t_3))))
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 t_3 = x + -t_1;
double tmp;
if (t_2 <= -40000000000.0) {
tmp = t_3;
} else if (t_2 <= 5e+15) {
tmp = t_0;
} else {
tmp = t_3;
}
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = x + cos(y)
t_1 = z * sin(y)
t_2 = t_0 - t_1
t_3 = x + -t_1
if (t_2 <= (-40000000000.0d0)) then
tmp = t_3
else if (t_2 <= 5d+15) then
tmp = t_0
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double t_1 = z * Math.sin(y);
double t_2 = t_0 - t_1;
double t_3 = x + -t_1;
double tmp;
if (t_2 <= -40000000000.0) {
tmp = t_3;
} else if (t_2 <= 5e+15) {
tmp = t_0;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) t_1 = z * math.sin(y) t_2 = t_0 - t_1 t_3 = x + -t_1 tmp = 0 if t_2 <= -40000000000.0: tmp = t_3 elif t_2 <= 5e+15: tmp = t_0 else: tmp = t_3 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) t_3 = Float64(x + Float64(-t_1)) tmp = 0.0 if (t_2 <= -40000000000.0) tmp = t_3; elseif (t_2 <= 5e+15) tmp = t_0; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); t_1 = z * sin(y); t_2 = t_0 - t_1; t_3 = x + -t_1; tmp = 0.0; if (t_2 <= -40000000000.0) tmp = t_3; elseif (t_2 <= 5e+15) tmp = t_0; else tmp = t_3; end tmp_2 = 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]}, Block[{t$95$3 = N[(x + (-t$95$1)), $MachinePrecision]}, If[LessEqual[t$95$2, -40000000000.0], t$95$3, If[LessEqual[t$95$2, 5e+15], t$95$0, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
t_3 := x + \left(-t\_1\right)\\
\mathbf{if}\;t\_2 \leq -40000000000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -4e10 or 5e15 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.8%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.6
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
associate--l+N/A
div-subN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6482.8
Applied rewrites82.8%
Taylor expanded in z around inf
Applied rewrites99.6%
if -4e10 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 5e15Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6498.5
Applied rewrites98.5%
Final simplification99.2%
(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.f6499.9
Applied rewrites99.9%
(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 -8.8e+74) (- (+ x 1.0) (* z (sin y))) (if (<= z 0.92) (+ x (cos y)) (fma (sin y) (- z) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.8e+74) {
tmp = (x + 1.0) - (z * sin(y));
} else if (z <= 0.92) {
tmp = x + cos(y);
} else {
tmp = fma(sin(y), -z, (x + 1.0));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -8.8e+74) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); elseif (z <= 0.92) tmp = Float64(x + cos(y)); else tmp = fma(sin(y), Float64(-z), Float64(x + 1.0)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -8.8e+74], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.92], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+74}:\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{elif}\;z \leq 0.92:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x + 1\right)\\
\end{array}
\end{array}
if z < -8.8000000000000005e74Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites99.8%
if -8.8000000000000005e74 < z < 0.92000000000000004Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
if 0.92000000000000004 < z Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites99.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
lower-fma.f6499.8
Applied rewrites99.8%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x 1.0) (* z (sin y))))) (if (<= z -8.8e+74) t_0 (if (<= z 0.92) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * sin(y));
double tmp;
if (z <= -8.8e+74) {
tmp = t_0;
} else if (z <= 0.92) {
tmp = x + cos(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 = (x + 1.0d0) - (z * sin(y))
if (z <= (-8.8d+74)) then
tmp = t_0
else if (z <= 0.92d0) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * Math.sin(y));
double tmp;
if (z <= -8.8e+74) {
tmp = t_0;
} else if (z <= 0.92) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + 1.0) - (z * math.sin(y)) tmp = 0 if z <= -8.8e+74: tmp = t_0 elif z <= 0.92: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 1.0) - Float64(z * sin(y))) tmp = 0.0 if (z <= -8.8e+74) tmp = t_0; elseif (z <= 0.92) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 1.0) - (z * sin(y)); tmp = 0.0; if (z <= -8.8e+74) tmp = t_0; elseif (z <= 0.92) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.8e+74], t$95$0, If[LessEqual[z, 0.92], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + 1\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -8.8 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.92:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -8.8000000000000005e74 or 0.92000000000000004 < z Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites99.8%
if -8.8000000000000005e74 < z < 0.92000000000000004Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6499.5
Applied rewrites99.5%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (* z (sin y))))) (if (<= z -2.2e+131) t_0 (if (<= z 3e+110) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = -(z * sin(y));
double tmp;
if (z <= -2.2e+131) {
tmp = t_0;
} else if (z <= 3e+110) {
tmp = x + cos(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 = -(z * sin(y))
if (z <= (-2.2d+131)) then
tmp = t_0
else if (z <= 3d+110) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -(z * Math.sin(y));
double tmp;
if (z <= -2.2e+131) {
tmp = t_0;
} else if (z <= 3e+110) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -(z * math.sin(y)) tmp = 0 if z <= -2.2e+131: tmp = t_0 elif z <= 3e+110: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-Float64(z * sin(y))) tmp = 0.0 if (z <= -2.2e+131) tmp = t_0; elseif (z <= 3e+110) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -(z * sin(y)); tmp = 0.0; if (z <= -2.2e+131) tmp = t_0; elseif (z <= 3e+110) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = (-N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision])}, If[LessEqual[z, -2.2e+131], t$95$0, If[LessEqual[z, 3e+110], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -z \cdot \sin y\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+131}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+110}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.1999999999999999e131 or 3.00000000000000007e110 < z Initial program 99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f6467.3
Applied rewrites67.3%
if -2.1999999999999999e131 < z < 3.00000000000000007e110Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6491.8
Applied rewrites91.8%
Final simplification83.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -0.03)
t_0
(if (<= y 3.6e-22)
(-
(+ x 1.0)
(*
y
(fma
(* y y)
(* z (fma (* y y) 0.008333333333333333 -0.16666666666666666))
z)))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -0.03) {
tmp = t_0;
} else if (y <= 3.6e-22) {
tmp = (x + 1.0) - (y * fma((y * y), (z * fma((y * y), 0.008333333333333333, -0.16666666666666666)), z));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -0.03) tmp = t_0; elseif (y <= 3.6e-22) tmp = Float64(Float64(x + 1.0) - Float64(y * fma(Float64(y * y), Float64(z * fma(Float64(y * y), 0.008333333333333333, -0.16666666666666666)), z))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.03], t$95$0, If[LessEqual[y, 3.6e-22], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(N[(y * y), $MachinePrecision] * N[(z * N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -0.03:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-22}:\\
\;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot y, z \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.029999999999999999 or 3.5999999999999998e-22 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6462.0
Applied rewrites62.0%
if -0.029999999999999999 < y < 3.5999999999999998e-22Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification80.7%
(FPCore (x y z)
:precision binary64
(if (<= y -8e+83)
(+ x (* x (/ 1.0 x)))
(if (<= y 4.1e+21)
(+ 1.0 (fma y (fma y (fma y (* z 0.16666666666666666) -0.5) (- z)) x))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8e+83) {
tmp = x + (x * (1.0 / x));
} else if (y <= 4.1e+21) {
tmp = 1.0 + fma(y, fma(y, fma(y, (z * 0.16666666666666666), -0.5), -z), x);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -8e+83) tmp = Float64(x + Float64(x * Float64(1.0 / x))); elseif (y <= 4.1e+21) tmp = Float64(1.0 + fma(y, fma(y, fma(y, Float64(z * 0.16666666666666666), -0.5), Float64(-z)), x)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -8e+83], N[(x + N[(x * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e+21], N[(1.0 + N[(y * N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision] + (-z)), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+83}:\\
\;\;\;\;x + x \cdot \frac{1}{x}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+21}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot 0.16666666666666666, -0.5\right), -z\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -8.00000000000000025e83Initial program 99.8%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.6
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
associate--l+N/A
div-subN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6481.2
Applied rewrites81.2%
Taylor expanded in y around 0
Applied rewrites45.8%
if -8.00000000000000025e83 < y < 4.1e21Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
lower-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6491.5
Applied rewrites91.5%
if 4.1e21 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.0
Applied rewrites41.0%
(FPCore (x y z)
:precision binary64
(if (<= y -8e+83)
(+ x (* x (/ 1.0 x)))
(if (<= y 3.6e+16)
(+ 1.0 (fma y (fma y (* z (* y 0.16666666666666666)) (- z)) x))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8e+83) {
tmp = x + (x * (1.0 / x));
} else if (y <= 3.6e+16) {
tmp = 1.0 + fma(y, fma(y, (z * (y * 0.16666666666666666)), -z), x);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -8e+83) tmp = Float64(x + Float64(x * Float64(1.0 / x))); elseif (y <= 3.6e+16) tmp = Float64(1.0 + fma(y, fma(y, Float64(z * Float64(y * 0.16666666666666666)), Float64(-z)), x)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -8e+83], N[(x + N[(x * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+16], N[(1.0 + N[(y * N[(y * N[(z * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + (-z)), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+83}:\\
\;\;\;\;x + x \cdot \frac{1}{x}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+16}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot \left(y \cdot 0.16666666666666666\right), -z\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -8.00000000000000025e83Initial program 99.8%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.6
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
associate--l+N/A
div-subN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6481.2
Applied rewrites81.2%
Taylor expanded in y around 0
Applied rewrites45.8%
if -8.00000000000000025e83 < y < 3.6e16Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
lower-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6492.1
Applied rewrites92.1%
Taylor expanded in y around inf
Applied rewrites92.0%
if 3.6e16 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6440.2
Applied rewrites40.2%
(FPCore (x y z) :precision binary64 (if (<= y -3.5e+64) (+ x (* x (/ 1.0 x))) (if (<= y 4.1e+21) (fma y (- (* y -0.5) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e+64) {
tmp = x + (x * (1.0 / x));
} else if (y <= 4.1e+21) {
tmp = fma(y, ((y * -0.5) - z), (x + 1.0));
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3.5e+64) tmp = Float64(x + Float64(x * Float64(1.0 / x))); elseif (y <= 4.1e+21) tmp = fma(y, Float64(Float64(y * -0.5) - z), Float64(x + 1.0)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+64], N[(x + N[(x * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e+21], N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+64}:\\
\;\;\;\;x + x \cdot \frac{1}{x}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -3.4999999999999999e64Initial program 99.8%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.6
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lower--.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
associate--l+N/A
div-subN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6478.4
Applied rewrites78.4%
Taylor expanded in y around 0
Applied rewrites42.5%
if -3.4999999999999999e64 < y < 4.1e21Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
if 4.1e21 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.0
Applied rewrites41.0%
(FPCore (x y z) :precision binary64 (if (<= y -3.5e+64) (+ x 1.0) (if (<= y 4.1e+21) (fma y (- (* y -0.5) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e+64) {
tmp = x + 1.0;
} else if (y <= 4.1e+21) {
tmp = fma(y, ((y * -0.5) - z), (x + 1.0));
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3.5e+64) tmp = Float64(x + 1.0); elseif (y <= 4.1e+21) tmp = fma(y, Float64(Float64(y * -0.5) - z), Float64(x + 1.0)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+64], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 4.1e+21], N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+64}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -3.4999999999999999e64 or 4.1e21 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6441.8
Applied rewrites41.8%
if -3.4999999999999999e64 < y < 4.1e21Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
(FPCore (x y z) :precision binary64 (if (<= y -7.1e+75) (+ x 1.0) (if (<= y 3.6e-22) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.1e+75) {
tmp = x + 1.0;
} else if (y <= 3.6e-22) {
tmp = x - fma(y, z, -1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -7.1e+75) tmp = Float64(x + 1.0); elseif (y <= 3.6e-22) tmp = Float64(x - fma(y, z, -1.0)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -7.1e+75], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 3.6e-22], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.1 \cdot 10^{+75}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-22}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -7.09999999999999982e75 or 3.5999999999999998e-22 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.9
Applied rewrites43.9%
if -7.09999999999999982e75 < y < 3.5999999999999998e-22Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6492.8
Applied rewrites92.8%
(FPCore (x y z) :precision binary64 (if (<= x -200.0) (+ x 1.0) (if (<= x 5e-20) (- 1.0 (* z y)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -200.0) {
tmp = x + 1.0;
} else if (x <= 5e-20) {
tmp = 1.0 - (z * y);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-200.0d0)) then
tmp = x + 1.0d0
else if (x <= 5d-20) then
tmp = 1.0d0 - (z * y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -200.0) {
tmp = x + 1.0;
} else if (x <= 5e-20) {
tmp = 1.0 - (z * y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -200.0: tmp = x + 1.0 elif x <= 5e-20: tmp = 1.0 - (z * y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -200.0) tmp = Float64(x + 1.0); elseif (x <= 5e-20) tmp = Float64(1.0 - Float64(z * y)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -200.0) tmp = x + 1.0; elseif (x <= 5e-20) tmp = 1.0 - (z * y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -200.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 5e-20], N[(1.0 - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -200:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-20}:\\
\;\;\;\;1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -200 or 4.9999999999999999e-20 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6485.9
Applied rewrites85.9%
if -200 < x < 4.9999999999999999e-20Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6454.4
Applied rewrites54.4%
Taylor expanded in x around 0
Applied rewrites54.2%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (if (<= z 8.5e+206) (+ x 1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 8.5e+206) {
tmp = x + 1.0;
} 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 <= 8.5d+206) then
tmp = x + 1.0d0
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 8.5e+206) {
tmp = x + 1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 8.5e+206: tmp = x + 1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 8.5e+206) tmp = Float64(x + 1.0); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 8.5e+206) tmp = x + 1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 8.5e+206], N[(x + 1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.5 \cdot 10^{+206}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 8.4999999999999996e206Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6467.9
Applied rewrites67.9%
if 8.4999999999999996e206 < z Initial program 99.6%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6444.8
Applied rewrites44.8%
Taylor expanded in y around inf
Applied rewrites31.4%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 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 = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6461.7
Applied rewrites61.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
+-commutativeN/A
lower-+.f6461.7
Applied rewrites61.7%
Taylor expanded in x around 0
Applied rewrites25.3%
herbie shell --seed 2024221
(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))))