
(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 (- (+ 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
(let* ((t_0 (+ x (cos y))) (t_1 (* z (sin y))) (t_2 (- t_0 t_1)))
(if (or (<= t_2 -1e+17) (not (<= t_2 1.001)))
(- (+ x 1.0) t_1)
(- t_0 (* z y)))))
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) || !(t_2 <= 1.001)) {
tmp = (x + 1.0) - t_1;
} else {
tmp = t_0 - (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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = x + cos(y)
t_1 = z * sin(y)
t_2 = t_0 - t_1
if ((t_2 <= (-1d+17)) .or. (.not. (t_2 <= 1.001d0))) then
tmp = (x + 1.0d0) - t_1
else
tmp = t_0 - (z * y)
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 tmp;
if ((t_2 <= -1e+17) || !(t_2 <= 1.001)) {
tmp = (x + 1.0) - t_1;
} else {
tmp = t_0 - (z * y);
}
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 tmp = 0 if (t_2 <= -1e+17) or not (t_2 <= 1.001): tmp = (x + 1.0) - t_1 else: tmp = t_0 - (z * y) 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) || !(t_2 <= 1.001)) tmp = Float64(Float64(x + 1.0) - t_1); else tmp = Float64(t_0 - Float64(z * y)); 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; tmp = 0.0; if ((t_2 <= -1e+17) || ~((t_2 <= 1.001))) tmp = (x + 1.0) - t_1; else tmp = t_0 - (z * y); 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]}, If[Or[LessEqual[t$95$2, -1e+17], N[Not[LessEqual[t$95$2, 1.001]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$1), $MachinePrecision], N[(t$95$0 - N[(z * y), $MachinePrecision]), $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} \lor \neg \left(t\_2 \leq 1.001\right):\\
\;\;\;\;\left(x + 1\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 - z \cdot y\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e17 or 1.0009999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.7%
if -1e17 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 1.0009999999999999Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
Final simplification92.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))) (t_1 (- (+ x (cos y)) t_0)))
(if (or (<= t_1 -4000000000.0) (not (<= t_1 1.001)))
(- (+ x 1.0) t_0)
(- (cos y) (* z y)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = (x + cos(y)) - t_0;
double tmp;
if ((t_1 <= -4000000000.0) || !(t_1 <= 1.001)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + cos(y)) - t_0
if ((t_1 <= (-4000000000.0d0)) .or. (.not. (t_1 <= 1.001d0))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = (x + Math.cos(y)) - t_0;
double tmp;
if ((t_1 <= -4000000000.0) || !(t_1 <= 1.001)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - (z * y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = (x + math.cos(y)) - t_0 tmp = 0 if (t_1 <= -4000000000.0) or not (t_1 <= 1.001): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - (z * y) return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(Float64(x + cos(y)) - t_0) tmp = 0.0 if ((t_1 <= -4000000000.0) || !(t_1 <= 1.001)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = (x + cos(y)) - t_0; tmp = 0.0; if ((t_1 <= -4000000000.0) || ~((t_1 <= 1.001))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4000000000.0], N[Not[LessEqual[t$95$1, 1.001]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := \left(x + \cos y\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -4000000000 \lor \neg \left(t\_1 \leq 1.001\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot y\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -4e9 or 1.0009999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.7%
if -4e9 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 1.0009999999999999Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6476.9
Applied rewrites76.9%
Taylor expanded in x around 0
lower-cos.f6475.1
Applied rewrites75.1%
Final simplification92.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -1.3e-6) (not (<= x 1.25e-21)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.3e-6) || !(x <= 1.25e-21)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - 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 ((x <= (-1.3d-6)) .or. (.not. (x <= 1.25d-21))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - 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 ((x <= -1.3e-6) || !(x <= 1.25e-21)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -1.3e-6) or not (x <= 1.25e-21): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -1.3e-6) || !(x <= 1.25e-21)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -1.3e-6) || ~((x <= 1.25e-21))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.3e-6], N[Not[LessEqual[x, 1.25e-21]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{-6} \lor \neg \left(x \leq 1.25 \cdot 10^{-21}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.30000000000000005e-6 or 1.24999999999999993e-21 < x Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.7%
if -1.30000000000000005e-6 < x < 1.24999999999999993e-21Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6499.9
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.4e-6) (not (<= x 5.6e-6))) (+ 1.0 x) (- (cos y) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4e-6) || !(x <= 5.6e-6)) {
tmp = 1.0 + x;
} else {
tmp = cos(y) - (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 ((x <= (-1.4d-6)) .or. (.not. (x <= 5.6d-6))) then
tmp = 1.0d0 + x
else
tmp = cos(y) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.4e-6) || !(x <= 5.6e-6)) {
tmp = 1.0 + x;
} else {
tmp = Math.cos(y) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.4e-6) or not (x <= 5.6e-6): tmp = 1.0 + x else: tmp = math.cos(y) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.4e-6) || !(x <= 5.6e-6)) tmp = Float64(1.0 + x); else tmp = Float64(cos(y) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.4e-6) || ~((x <= 5.6e-6))) tmp = 1.0 + x; else tmp = cos(y) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4e-6], N[Not[LessEqual[x, 5.6e-6]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-6} \lor \neg \left(x \leq 5.6 \cdot 10^{-6}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot y\\
\end{array}
\end{array}
if x < -1.39999999999999994e-6 or 5.59999999999999975e-6 < x Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6486.5
Applied rewrites86.5%
if -1.39999999999999994e-6 < x < 5.59999999999999975e-6Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in x around 0
lower-cos.f6461.0
Applied rewrites61.0%
Final simplification74.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.3e+137) (not (<= z 5.1e+147))) (* (- z) (sin y)) (+ 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e+137) || !(z <= 5.1e+147)) {
tmp = -z * sin(y);
} else {
tmp = 1.0 + x;
}
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.3d+137)) .or. (.not. (z <= 5.1d+147))) then
tmp = -z * sin(y)
else
tmp = 1.0d0 + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e+137) || !(z <= 5.1e+147)) {
tmp = -z * Math.sin(y);
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e+137) or not (z <= 5.1e+147): tmp = -z * math.sin(y) else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e+137) || !(z <= 5.1e+147)) tmp = Float64(Float64(-z) * sin(y)); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.3e+137) || ~((z <= 5.1e+147))) tmp = -z * sin(y); else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e+137], N[Not[LessEqual[z, 5.1e+147]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+137} \lor \neg \left(z \leq 5.1 \cdot 10^{+147}\right):\\
\;\;\;\;\left(-z\right) \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if z < -1.3e137 or 5.09999999999999999e147 < 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.f6471.2
Applied rewrites71.2%
if -1.3e137 < z < 5.09999999999999999e147Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6474.6
Applied rewrites74.6%
Final simplification73.7%
(FPCore (x y z)
:precision binary64
(if (or (<= y -36000000000.0) (not (<= y 15.5)))
(+ 1.0 x)
(-
(+ x (fma (- (* 0.041666666666666664 (* y y)) 0.5) (* y y) 1.0))
(*
(fma
(* z (fma 0.008333333333333333 (* y y) -0.16666666666666666))
(* y y)
z)
y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -36000000000.0) || !(y <= 15.5)) {
tmp = 1.0 + x;
} else {
tmp = (x + fma(((0.041666666666666664 * (y * y)) - 0.5), (y * y), 1.0)) - (fma((z * fma(0.008333333333333333, (y * y), -0.16666666666666666)), (y * y), z) * y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -36000000000.0) || !(y <= 15.5)) tmp = Float64(1.0 + x); else tmp = Float64(Float64(x + fma(Float64(Float64(0.041666666666666664 * Float64(y * y)) - 0.5), Float64(y * y), 1.0)) - Float64(fma(Float64(z * fma(0.008333333333333333, Float64(y * y), -0.16666666666666666)), Float64(y * y), z) * y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -36000000000.0], N[Not[LessEqual[y, 15.5]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(x + N[(N[(N[(0.041666666666666664 * N[(y * y), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(z * N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -36000000000 \lor \neg \left(y \leq 15.5\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(0.041666666666666664 \cdot \left(y \cdot y\right) - 0.5, y \cdot y, 1\right)\right) - \mathsf{fma}\left(z \cdot \mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right), y \cdot y, z\right) \cdot y\\
\end{array}
\end{array}
if y < -3.6e10 or 15.5 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6444.8
Applied rewrites44.8%
if -3.6e10 < y < 15.5Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6498.8
Applied rewrites98.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.0
Applied rewrites99.0%
Final simplification71.9%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.65e+16) (not (<= y 750.0)))
(+ 1.0 x)
(-
(+ x (fma (* y y) -0.5 1.0))
(fma
z
y
(*
(* (* (* y y) z) (fma (* y y) 0.008333333333333333 -0.16666666666666666))
y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.65e+16) || !(y <= 750.0)) {
tmp = 1.0 + x;
} else {
tmp = (x + fma((y * y), -0.5, 1.0)) - fma(z, y, ((((y * y) * z) * fma((y * y), 0.008333333333333333, -0.16666666666666666)) * y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.65e+16) || !(y <= 750.0)) tmp = Float64(1.0 + x); else tmp = Float64(Float64(x + fma(Float64(y * y), -0.5, 1.0)) - fma(z, y, Float64(Float64(Float64(Float64(y * y) * z) * fma(Float64(y * y), 0.008333333333333333, -0.16666666666666666)) * y))); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.65e+16], N[Not[LessEqual[y, 750.0]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(x + N[(N[(y * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] - N[(z * y + N[(N[(N[(N[(y * y), $MachinePrecision] * z), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+16} \lor \neg \left(y \leq 750\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(y \cdot y, -0.5, 1\right)\right) - \mathsf{fma}\left(z, y, \left(\left(\left(y \cdot y\right) \cdot z\right) \cdot \mathsf{fma}\left(y \cdot y, 0.008333333333333333, -0.16666666666666666\right)\right) \cdot y\right)\\
\end{array}
\end{array}
if y < -1.65e16 or 750 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6444.7
Applied rewrites44.7%
if -1.65e16 < y < 750Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.9
Applied rewrites97.9%
Applied rewrites97.9%
Final simplification71.8%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.65e+16) (not (<= y 750.0)))
(+ 1.0 x)
(-
(+ x (fma (* y y) -0.5 1.0))
(*
(fma
(* (fma 0.008333333333333333 (* y y) -0.16666666666666666) z)
(* y y)
z)
y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.65e+16) || !(y <= 750.0)) {
tmp = 1.0 + x;
} else {
tmp = (x + fma((y * y), -0.5, 1.0)) - (fma((fma(0.008333333333333333, (y * y), -0.16666666666666666) * z), (y * y), z) * y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.65e+16) || !(y <= 750.0)) tmp = Float64(1.0 + x); else tmp = Float64(Float64(x + fma(Float64(y * y), -0.5, 1.0)) - Float64(fma(Float64(fma(0.008333333333333333, Float64(y * y), -0.16666666666666666) * z), Float64(y * y), z) * y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.65e+16], N[Not[LessEqual[y, 750.0]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(x + N[(N[(y * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * z), $MachinePrecision] * N[(y * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+16} \lor \neg \left(y \leq 750\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(y \cdot y, -0.5, 1\right)\right) - \mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right) \cdot z, y \cdot y, z\right) \cdot y\\
\end{array}
\end{array}
if y < -1.65e16 or 750 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6444.7
Applied rewrites44.7%
if -1.65e16 < y < 750Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6498.6
Applied rewrites98.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.9
Applied rewrites97.9%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.25e+28) (not (<= y 8500.0))) (+ 1.0 x) (fma (fma (- (* (* 0.16666666666666666 z) y) 0.5) y (- z)) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.25e+28) || !(y <= 8500.0)) {
tmp = 1.0 + x;
} else {
tmp = fma(fma((((0.16666666666666666 * z) * y) - 0.5), y, -z), y, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.25e+28) || !(y <= 8500.0)) tmp = Float64(1.0 + x); else tmp = fma(fma(Float64(Float64(Float64(0.16666666666666666 * z) * y) - 0.5), y, Float64(-z)), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.25e+28], N[Not[LessEqual[y, 8500.0]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * z), $MachinePrecision] * y), $MachinePrecision] - 0.5), $MachinePrecision] * y + (-z)), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+28} \lor \neg \left(y \leq 8500\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(0.16666666666666666 \cdot z\right) \cdot y - 0.5, y, -z\right), y, 1 + x\right)\\
\end{array}
\end{array}
if y < -1.24999999999999989e28 or 8500 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6444.7
Applied rewrites44.7%
if -1.24999999999999989e28 < y < 8500Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites97.2%
Final simplification71.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.65e+16) (not (<= y 750.0))) (+ 1.0 x) (fma (- (* -0.5 y) z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.65e+16) || !(y <= 750.0)) {
tmp = 1.0 + x;
} else {
tmp = fma(((-0.5 * y) - z), y, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.65e+16) || !(y <= 750.0)) tmp = Float64(1.0 + x); else tmp = fma(Float64(Float64(-0.5 * y) - z), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.65e+16], N[Not[LessEqual[y, 750.0]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+16} \lor \neg \left(y \leq 750\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -1.65e16 or 750 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6444.7
Applied rewrites44.7%
if -1.65e16 < y < 750Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f6497.7
Applied rewrites97.7%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.25e+16) (not (<= y 15.5))) (+ 1.0 x) (fma (- z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.25e+16) || !(y <= 15.5)) {
tmp = 1.0 + x;
} else {
tmp = fma(-z, y, (1.0 + x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -3.25e+16) || !(y <= 15.5)) tmp = Float64(1.0 + x); else tmp = fma(Float64(-z), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.25e+16], N[Not[LessEqual[y, 15.5]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[((-z) * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+16} \lor \neg \left(y \leq 15.5\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -3.25e16 or 15.5 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6444.7
Applied rewrites44.7%
if -3.25e16 < y < 15.5Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-+.f6497.2
Applied rewrites97.2%
Final simplification71.4%
(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.1
Applied rewrites63.1%
(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.1
Applied rewrites63.1%
Taylor expanded in x around 0
Applied rewrites19.7%
herbie shell --seed 2024329
(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))))