
(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 15 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 (+ (cos y) x)) (t_1 (fma (sin y) z t_0))) (* t_1 (/ (fma (- z) (sin y) t_0) t_1))))
double code(double x, double y, double z) {
double t_0 = cos(y) + x;
double t_1 = fma(sin(y), z, t_0);
return t_1 * (fma(-z, sin(y), t_0) / t_1);
}
function code(x, y, z) t_0 = Float64(cos(y) + x) t_1 = fma(sin(y), z, t_0) return Float64(t_1 * Float64(fma(Float64(-z), sin(y), t_0) / t_1)) end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[y], $MachinePrecision] * z + t$95$0), $MachinePrecision]}, N[(t$95$1 * N[(N[((-z) * N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y + x\\
t_1 := \mathsf{fma}\left(\sin y, z, t\_0\right)\\
t\_1 \cdot \frac{\mathsf{fma}\left(-z, \sin y, t\_0\right)}{t\_1}
\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
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))) (t_1 (- (+ x (cos y)) t_0)))
(if (or (<= t_1 -10000.0) (not (<= t_1 0.81)))
(- (+ 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 <= -10000.0) || !(t_1 <= 0.81)) {
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 <= (-10000.0d0)) .or. (.not. (t_1 <= 0.81d0))) 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 <= -10000.0) || !(t_1 <= 0.81)) {
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 <= -10000.0) or not (t_1 <= 0.81): 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 <= -10000.0) || !(t_1 <= 0.81)) 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 <= -10000.0) || ~((t_1 <= 0.81))) 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, -10000.0], N[Not[LessEqual[t$95$1, 0.81]], $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 -10000 \lor \neg \left(t\_1 \leq 0.81\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))) < -1e4 or 0.81000000000000005 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites97.0%
if -1e4 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.81000000000000005Initial program 99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6465.5
Applied rewrites65.5%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6418.3
Applied rewrites18.3%
Taylor expanded in x around 0
lower-cos.f6462.2
Applied rewrites62.2%
Final simplification93.7%
(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 (or (<= z -7e+18) (not (<= z 1.02e-44))) (- (+ x 1.0) (* z (sin y))) (fma (/ (cos y) x) x x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7e+18) || !(z <= 1.02e-44)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = fma((cos(y) / x), x, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -7e+18) || !(z <= 1.02e-44)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = fma(Float64(cos(y) / x), x, x); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -7e+18], N[Not[LessEqual[z, 1.02e-44]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+18} \lor \neg \left(z \leq 1.02 \cdot 10^{-44}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\cos y}{x}, x, x\right)\\
\end{array}
\end{array}
if z < -7e18 or 1.0199999999999999e-44 < z Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites99.2%
if -7e18 < z < 1.0199999999999999e-44Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6480.1
Applied rewrites80.1%
Taylor expanded in x around inf
associate--l+N/A
div-subN/A
distribute-rgt-inN/A
*-lft-identityN/A
distribute-rgt1-inN/A
distribute-lft1-inN/A
lower-fma.f64N/A
sub-negN/A
mul-1-negN/A
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sin.f64N/A
lower-cos.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites99.9%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.45e-216) (not (<= z 3.4e-133))) (- (+ x 1.0) (* z (sin y))) (- (+ x (cos y)) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.45e-216) || !(z <= 3.4e-133)) {
tmp = (x + 1.0) - (z * sin(y));
} else {
tmp = (x + 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 ((z <= (-1.45d-216)) .or. (.not. (z <= 3.4d-133))) then
tmp = (x + 1.0d0) - (z * sin(y))
else
tmp = (x + cos(y)) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.45e-216) || !(z <= 3.4e-133)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = (x + Math.cos(y)) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.45e-216) or not (z <= 3.4e-133): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = (x + math.cos(y)) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.45e-216) || !(z <= 3.4e-133)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(Float64(x + cos(y)) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.45e-216) || ~((z <= 3.4e-133))) tmp = (x + 1.0) - (z * sin(y)); else tmp = (x + cos(y)) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.45e-216], N[Not[LessEqual[z, 3.4e-133]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-216} \lor \neg \left(z \leq 3.4 \cdot 10^{-133}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\left(x + \cos y\right) - z \cdot y\\
\end{array}
\end{array}
if z < -1.45e-216 or 3.40000000000000006e-133 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites94.9%
if -1.45e-216 < z < 3.40000000000000006e-133Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6493.7
Applied rewrites93.7%
Final simplification94.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.6e+62) (not (<= z 2.9e+130))) (* (- z) (sin y)) (+ 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e+62) || !(z <= 2.9e+130)) {
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 <= (-6.6d+62)) .or. (.not. (z <= 2.9d+130))) 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 <= -6.6e+62) || !(z <= 2.9e+130)) {
tmp = -z * Math.sin(y);
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.6e+62) or not (z <= 2.9e+130): tmp = -z * math.sin(y) else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.6e+62) || !(z <= 2.9e+130)) 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 <= -6.6e+62) || ~((z <= 2.9e+130))) tmp = -z * sin(y); else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.6e+62], N[Not[LessEqual[z, 2.9e+130]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{+62} \lor \neg \left(z \leq 2.9 \cdot 10^{+130}\right):\\
\;\;\;\;\left(-z\right) \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if z < -6.6e62 or 2.8999999999999999e130 < 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.f6470.1
Applied rewrites70.1%
if -6.6e62 < z < 2.8999999999999999e130Initial program 100.0%
Taylor expanded in y around 0
lower-+.f6480.5
Applied rewrites80.5%
Final simplification76.9%
(FPCore (x y z)
:precision binary64
(if (or (<= y -270000.0) (not (<= y 1.7e+38)))
(+ 1.0 x)
(-
(+
x
(fma
(fma
(fma -0.001388888888888889 (* y y) 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 <= -270000.0) || !(y <= 1.7e+38)) {
tmp = 1.0 + x;
} else {
tmp = (x + fma(fma(fma(-0.001388888888888889, (y * y), 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 <= -270000.0) || !(y <= 1.7e+38)) tmp = Float64(1.0 + x); else tmp = Float64(Float64(x + fma(fma(fma(-0.001388888888888889, Float64(y * y), 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, -270000.0], N[Not[LessEqual[y, 1.7e+38]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(x + N[(N[(N[(-0.001388888888888889 * N[(y * y), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(y * y), $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 -270000 \lor \neg \left(y \leq 1.7 \cdot 10^{+38}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, y \cdot y, 0.041666666666666664\right), y \cdot y, -0.5\right), 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 < -2.7e5 or 1.69999999999999998e38 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6442.1
Applied rewrites42.1%
if -2.7e5 < y < 1.69999999999999998e38Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6496.2
Applied rewrites96.2%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.7%
Final simplification71.2%
(FPCore (x y z)
:precision binary64
(if (or (<= y -480000.0) (not (<= y 1.7e+38)))
(+ 1.0 x)
(-
(+ x (fma (* y y) -0.5 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 <= -480000.0) || !(y <= 1.7e+38)) {
tmp = 1.0 + x;
} else {
tmp = (x + fma((y * y), -0.5, 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 <= -480000.0) || !(y <= 1.7e+38)) tmp = Float64(1.0 + x); else tmp = Float64(Float64(x + fma(Float64(y * y), -0.5, 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, -480000.0], N[Not[LessEqual[y, 1.7e+38]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(x + N[(N[(y * y), $MachinePrecision] * -0.5 + 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 -480000 \lor \neg \left(y \leq 1.7 \cdot 10^{+38}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(y \cdot y, -0.5, 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 < -4.8e5 or 1.69999999999999998e38 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6442.1
Applied rewrites42.1%
if -4.8e5 < y < 1.69999999999999998e38Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6496.2
Applied rewrites96.2%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6495.5
Applied rewrites95.5%
Final simplification71.1%
(FPCore (x y z)
:precision binary64
(if (or (<= y -270000.0) (not (<= y 1.7e+38)))
(+ 1.0 x)
(-
(+
x
(fma
(fma
(fma -0.001388888888888889 (* y y) 0.041666666666666664)
(* y y)
-0.5)
(* y y)
1.0))
(* z y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -270000.0) || !(y <= 1.7e+38)) {
tmp = 1.0 + x;
} else {
tmp = (x + fma(fma(fma(-0.001388888888888889, (y * y), 0.041666666666666664), (y * y), -0.5), (y * y), 1.0)) - (z * y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -270000.0) || !(y <= 1.7e+38)) tmp = Float64(1.0 + x); else tmp = Float64(Float64(x + fma(fma(fma(-0.001388888888888889, Float64(y * y), 0.041666666666666664), Float64(y * y), -0.5), Float64(y * y), 1.0)) - Float64(z * y)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -270000.0], N[Not[LessEqual[y, 1.7e+38]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(x + N[(N[(N[(-0.001388888888888889 * N[(y * y), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(y * y), $MachinePrecision] + -0.5), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -270000 \lor \neg \left(y \leq 1.7 \cdot 10^{+38}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, y \cdot y, 0.041666666666666664\right), y \cdot y, -0.5\right), y \cdot y, 1\right)\right) - z \cdot y\\
\end{array}
\end{array}
if y < -2.7e5 or 1.69999999999999998e38 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6442.1
Applied rewrites42.1%
if -2.7e5 < y < 1.69999999999999998e38Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6496.2
Applied rewrites96.2%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.4
Applied rewrites95.4%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1150000.0) (not (<= y 2.6e+45))) (+ 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 <= -1150000.0) || !(y <= 2.6e+45)) {
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 <= -1150000.0) || !(y <= 2.6e+45)) tmp = Float64(1.0 + x); else tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(z * y), -0.5) * y) - z), y, Float64(1.0 + x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1150000.0], N[Not[LessEqual[y, 2.6e+45]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision] + -0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1150000 \lor \neg \left(y \leq 2.6 \cdot 10^{+45}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5\right) \cdot y - z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -1.15e6 or 2.60000000000000007e45 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6442.4
Applied rewrites42.4%
if -1.15e6 < y < 2.60000000000000007e45Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6494.7
Applied rewrites94.7%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -480000.0) (not (<= y 1.7e+38))) (+ 1.0 x) (fma (- (* -0.5 y) z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -480000.0) || !(y <= 1.7e+38)) {
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 <= -480000.0) || !(y <= 1.7e+38)) 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, -480000.0], N[Not[LessEqual[y, 1.7e+38]], $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 -480000 \lor \neg \left(y \leq 1.7 \cdot 10^{+38}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -4.8e5 or 1.69999999999999998e38 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6442.1
Applied rewrites42.1%
if -4.8e5 < y < 1.69999999999999998e38Initial 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-+.f6495.3
Applied rewrites95.3%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -8.5e+87) (not (<= y 2.9e+38))) (+ 1.0 x) (- x (fma z y -1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.5e+87) || !(y <= 2.9e+38)) {
tmp = 1.0 + x;
} else {
tmp = x - fma(z, y, -1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -8.5e+87) || !(y <= 2.9e+38)) tmp = Float64(1.0 + x); else tmp = Float64(x - fma(z, y, -1.0)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.5e+87], N[Not[LessEqual[y, 2.9e+38]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+87} \lor \neg \left(y \leq 2.9 \cdot 10^{+38}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\end{array}
\end{array}
if y < -8.5000000000000001e87 or 2.90000000000000007e38 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6443.3
Applied rewrites43.3%
if -8.5000000000000001e87 < y < 2.90000000000000007e38Initial program 99.9%
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
*-commutativeN/A
metadata-evalN/A
lower-fma.f6489.0
Applied rewrites89.0%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.75e+225) (* (- y) z) (+ 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.75e+225) {
tmp = -y * z;
} 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.75d+225)) then
tmp = -y * z
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.75e+225) {
tmp = -y * z;
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.75e+225: tmp = -y * z else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.75e+225) tmp = Float64(Float64(-y) * z); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.75e+225) tmp = -y * z; else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.75e+225], N[((-y) * z), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+225}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if z < -1.7500000000000002e225Initial program 99.7%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6487.5
Applied rewrites87.5%
Taylor expanded in y around 0
Applied rewrites30.0%
if -1.7500000000000002e225 < z Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6467.6
Applied rewrites67.6%
(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-+.f6462.8
Applied rewrites62.8%
(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-+.f6462.8
Applied rewrites62.8%
Taylor expanded in x around 0
Applied rewrites19.9%
herbie shell --seed 2024321
(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))))