
(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 11 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 (* z (sin y))) (t_1 (- (+ x (cos y)) t_0)))
(if (or (<= t_1 -1000000000000.0) (not (<= t_1 0.996)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
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 <= -1000000000000.0) || !(t_1 <= 0.996)) {
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) :: t_1
real(8) :: tmp
t_0 = z * sin(y)
t_1 = (x + cos(y)) - t_0
if ((t_1 <= (-1000000000000.0d0)) .or. (.not. (t_1 <= 0.996d0))) 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 t_1 = (x + Math.cos(y)) - t_0;
double tmp;
if ((t_1 <= -1000000000000.0) || !(t_1 <= 0.996)) {
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) t_1 = (x + math.cos(y)) - t_0 tmp = 0 if (t_1 <= -1000000000000.0) or not (t_1 <= 0.996): 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)) t_1 = Float64(Float64(x + cos(y)) - t_0) tmp = 0.0 if ((t_1 <= -1000000000000.0) || !(t_1 <= 0.996)) 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); t_1 = (x + cos(y)) - t_0; tmp = 0.0; if ((t_1 <= -1000000000000.0) || ~((t_1 <= 0.996))) 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]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1000000000000.0], N[Not[LessEqual[t$95$1, 0.996]], $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\\
t_1 := \left(x + \cos y\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -1000000000000 \lor \neg \left(t\_1 \leq 0.996\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e12 or 0.996 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.5%
if -1e12 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.996Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6492.2
Applied rewrites92.2%
Final simplification98.5%
(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 -0.99) (not (<= t_2 40000000.0)))
(- (+ 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 <= -0.99) || !(t_2 <= 40000000.0)) {
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 <= (-0.99d0)) .or. (.not. (t_2 <= 40000000.0d0))) 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 <= -0.99) || !(t_2 <= 40000000.0)) {
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 <= -0.99) or not (t_2 <= 40000000.0): 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 <= -0.99) || !(t_2 <= 40000000.0)) 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 <= -0.99) || ~((t_2 <= 40000000.0))) 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, -0.99], N[Not[LessEqual[t$95$2, 40000000.0]], $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 -0.99 \lor \neg \left(t\_2 \leq 40000000\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))) < -0.98999999999999999 or 4e7 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.0%
if -0.98999999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 4e7Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
Final simplification93.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))) (t_1 (- (+ x (cos y)) t_0)))
(if (or (<= t_1 -0.99) (not (<= t_1 0.99)))
(- (+ 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 <= -0.99) || !(t_1 <= 0.99)) {
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 <= (-0.99d0)) .or. (.not. (t_1 <= 0.99d0))) 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 <= -0.99) || !(t_1 <= 0.99)) {
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 <= -0.99) or not (t_1 <= 0.99): 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 <= -0.99) || !(t_1 <= 0.99)) 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 <= -0.99) || ~((t_1 <= 0.99))) 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, -0.99], N[Not[LessEqual[t$95$1, 0.99]], $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 -0.99 \lor \neg \left(t\_1 \leq 0.99\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))) < -0.98999999999999999 or 0.98999999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites98.8%
if -0.98999999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.98999999999999999Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6491.6
Applied rewrites91.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
Final simplification92.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.1e-7) (not (<= x 2.55e-8))) (+ 1.0 x) (- (cos y) (* z y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.1e-7) || !(x <= 2.55e-8)) {
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 <= (-4.1d-7)) .or. (.not. (x <= 2.55d-8))) 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 <= -4.1e-7) || !(x <= 2.55e-8)) {
tmp = 1.0 + x;
} else {
tmp = Math.cos(y) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.1e-7) or not (x <= 2.55e-8): tmp = 1.0 + x else: tmp = math.cos(y) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.1e-7) || !(x <= 2.55e-8)) 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 <= -4.1e-7) || ~((x <= 2.55e-8))) tmp = 1.0 + x; else tmp = cos(y) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.1e-7], N[Not[LessEqual[x, 2.55e-8]], $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 -4.1 \cdot 10^{-7} \lor \neg \left(x \leq 2.55 \cdot 10^{-8}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot y\\
\end{array}
\end{array}
if x < -4.0999999999999999e-7 or 2.55e-8 < x Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6480.7
Applied rewrites80.7%
if -4.0999999999999999e-7 < x < 2.55e-8Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6498.7
Applied rewrites98.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6461.9
Applied rewrites61.9%
Final simplification71.4%
(FPCore (x y z)
:precision binary64
(if (or (<= y -4.1e+23) (not (<= y 3.6e+14)))
(* (- z) (sin y))
(-
(+
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 <= -4.1e+23) || !(y <= 3.6e+14)) {
tmp = -z * sin(y);
} 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 <= -4.1e+23) || !(y <= 3.6e+14)) tmp = Float64(Float64(-z) * sin(y)); 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, -4.1e+23], N[Not[LessEqual[y, 3.6e+14]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $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 -4.1 \cdot 10^{+23} \lor \neg \left(y \leq 3.6 \cdot 10^{+14}\right):\\
\;\;\;\;\left(-z\right) \cdot \sin y\\
\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 < -4.09999999999999996e23 or 3.6e14 < y 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.f6442.1
Applied rewrites42.1%
if -4.09999999999999996e23 < y < 3.6e14Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
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-*.f6496.7
Applied rewrites96.7%
Final simplification71.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -880000000000.0) (not (<= y 5.2e+33))) (+ 1.0 x) (fma (- (* -0.5 y) z) y (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -880000000000.0) || !(y <= 5.2e+33)) {
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 <= -880000000000.0) || !(y <= 5.2e+33)) 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, -880000000000.0], N[Not[LessEqual[y, 5.2e+33]], $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 -880000000000 \lor \neg \left(y \leq 5.2 \cdot 10^{+33}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
\end{array}
\end{array}
if y < -8.8e11 or 5.1999999999999995e33 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6436.2
Applied rewrites36.2%
if -8.8e11 < y < 5.1999999999999995e33Initial 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-+.f6494.1
Applied rewrites94.1%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.4e+56) (not (<= y 1.66e+25))) (+ 1.0 x) (- x (fma z y -1.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.4e+56) || !(y <= 1.66e+25)) {
tmp = 1.0 + x;
} else {
tmp = x - fma(z, y, -1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.4e+56) || !(y <= 1.66e+25)) 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, -1.4e+56], N[Not[LessEqual[y, 1.66e+25]], $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 -1.4 \cdot 10^{+56} \lor \neg \left(y \leq 1.66 \cdot 10^{+25}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\end{array}
\end{array}
if y < -1.40000000000000004e56 or 1.6600000000000001e25 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6437.2
Applied rewrites37.2%
if -1.40000000000000004e56 < y < 1.6600000000000001e25Initial 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
*-commutativeN/A
metadata-evalN/A
lower-fma.f6489.9
Applied rewrites89.9%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -3e-42) (not (<= x 2.5e-8))) (+ 1.0 x) (fma (- y) z 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3e-42) || !(x <= 2.5e-8)) {
tmp = 1.0 + x;
} else {
tmp = fma(-y, z, 1.0);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -3e-42) || !(x <= 2.5e-8)) tmp = Float64(1.0 + x); else tmp = fma(Float64(-y), z, 1.0); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -3e-42], N[Not[LessEqual[x, 2.5e-8]], $MachinePrecision]], N[(1.0 + x), $MachinePrecision], N[((-y) * z + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-42} \lor \neg \left(x \leq 2.5 \cdot 10^{-8}\right):\\
\;\;\;\;1 + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, 1\right)\\
\end{array}
\end{array}
if x < -3.00000000000000027e-42 or 2.4999999999999999e-8 < x Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6477.0
Applied rewrites77.0%
if -3.00000000000000027e-42 < x < 2.4999999999999999e-8Initial 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.f6452.6
Applied rewrites52.6%
Taylor expanded in x around 0
Applied rewrites52.4%
Final simplification65.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-+.f6460.5
Applied rewrites60.5%
(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-+.f6460.5
Applied rewrites60.5%
Taylor expanded in x around 0
Applied rewrites21.6%
herbie shell --seed 2024324
(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))))