
(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 12 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 (<= t_2 -1000000000000.0)
(fma (sin y) (- z) x)
(if (<= t_2 0.99) t_0 (- (+ x 1.0) t_1)))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = z * sin(y);
double t_2 = t_0 - t_1;
double tmp;
if (t_2 <= -1000000000000.0) {
tmp = fma(sin(y), -z, x);
} else if (t_2 <= 0.99) {
tmp = t_0;
} else {
tmp = (x + 1.0) - t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(z * sin(y)) t_2 = Float64(t_0 - t_1) tmp = 0.0 if (t_2 <= -1000000000000.0) tmp = fma(sin(y), Float64(-z), x); elseif (t_2 <= 0.99) tmp = t_0; else tmp = Float64(Float64(x + 1.0) - t_1); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -1000000000000.0], N[(N[Sin[y], $MachinePrecision] * (-z) + x), $MachinePrecision], If[LessEqual[t$95$2, 0.99], t$95$0, N[(N[(x + 1.0), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
\mathbf{if}\;t\_2 \leq -1000000000000:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x\right)\\
\mathbf{elif}\;t\_2 \leq 0.99:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e12Initial program 99.9%
lift-cos.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.7
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
Applied rewrites99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
*-rgt-identityN/A
lift-sin.f64N/A
lift-*.f64N/A
/-rgt-identityN/A
sub-negN/A
*-rgt-identityN/A
/-rgt-identityN/A
unsub-negN/A
lift-neg.f64N/A
lift-+.f64N/A
remove-double-div99.8
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
if -1e12 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.98999999999999999Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6497.8
Applied rewrites97.8%
if 0.98999999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y)))
(t_1 (- t_0 (* z (sin y))))
(t_2 (fma (sin y) (- z) x)))
(if (<= t_1 -1000000000000.0) t_2 (if (<= t_1 5e+14) t_0 t_2))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = t_0 - (z * sin(y));
double t_2 = fma(sin(y), -z, x);
double tmp;
if (t_1 <= -1000000000000.0) {
tmp = t_2;
} else if (t_1 <= 5e+14) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(t_0 - Float64(z * sin(y))) t_2 = fma(sin(y), Float64(-z), x) tmp = 0.0 if (t_1 <= -1000000000000.0) tmp = t_2; elseif (t_1 <= 5e+14) tmp = t_0; else tmp = t_2; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[y], $MachinePrecision] * (-z) + x), $MachinePrecision]}, If[LessEqual[t$95$1, -1000000000000.0], t$95$2, If[LessEqual[t$95$1, 5e+14], t$95$0, t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := t\_0 - z \cdot \sin y\\
t_2 := \mathsf{fma}\left(\sin y, -z, x\right)\\
\mathbf{if}\;t\_1 \leq -1000000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e12 or 5e14 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
lift-cos.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.7
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
Applied rewrites99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
*-rgt-identityN/A
lift-sin.f64N/A
lift-*.f64N/A
/-rgt-identityN/A
sub-negN/A
*-rgt-identityN/A
/-rgt-identityN/A
unsub-negN/A
lift-neg.f64N/A
lift-+.f64N/A
remove-double-div99.9
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
if -1e12 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 5e14Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6496.8
Applied rewrites96.8%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x (cos y)) (* z (sin y)))) (t_1 (- x (fma y z -1.0)))) (if (<= t_0 -10000000.0) t_1 (if (<= t_0 0.99) (cos y) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (z * sin(y));
double t_1 = x - fma(y, z, -1.0);
double tmp;
if (t_0 <= -10000000.0) {
tmp = t_1;
} else if (t_0 <= 0.99) {
tmp = cos(y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + cos(y)) - Float64(z * sin(y))) t_1 = Float64(x - fma(y, z, -1.0)) tmp = 0.0 if (t_0 <= -10000000.0) tmp = t_1; elseif (t_0 <= 0.99) tmp = cos(y); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -10000000.0], t$95$1, If[LessEqual[t$95$0, 0.99], N[Cos[y], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
t_1 := x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{if}\;t\_0 \leq -10000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.99:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e7 or 0.98999999999999999 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial 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
metadata-evalN/A
lower-fma.f6475.5
Applied rewrites75.5%
if -1e7 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.98999999999999999Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6497.7
Applied rewrites97.7%
Taylor expanded in x around 0
lower-cos.f6493.5
Applied rewrites93.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (sin y) (- z)))) (if (<= z -1.35e+224) t_0 (if (<= z 1.1e+155) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -1.35e+224) {
tmp = t_0;
} else if (z <= 1.1e+155) {
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 = sin(y) * -z
if (z <= (-1.35d+224)) then
tmp = t_0
else if (z <= 1.1d+155) 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 = Math.sin(y) * -z;
double tmp;
if (z <= -1.35e+224) {
tmp = t_0;
} else if (z <= 1.1e+155) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -1.35e+224: tmp = t_0 elif z <= 1.1e+155: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -1.35e+224) tmp = t_0; elseif (z <= 1.1e+155) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -1.35e+224) tmp = t_0; elseif (z <= 1.1e+155) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -1.35e+224], t$95$0, If[LessEqual[z, 1.1e+155], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+224}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+155}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.3499999999999999e224 or 1.1000000000000001e155 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f6478.1
Applied rewrites78.1%
if -1.3499999999999999e224 < z < 1.1000000000000001e155Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6487.3
Applied rewrites87.3%
Final simplification85.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -2.25e+50)
t_0
(if (<= y 0.0305) (fma y (- (* y -0.5) z) (+ x 1.0)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -2.25e+50) {
tmp = t_0;
} else if (y <= 0.0305) {
tmp = fma(y, ((y * -0.5) - z), (x + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -2.25e+50) tmp = t_0; elseif (y <= 0.0305) tmp = fma(y, Float64(Float64(y * -0.5) - z), Float64(x + 1.0)); 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, -2.25e+50], t$95$0, If[LessEqual[y, 0.0305], N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -2.25 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.0305:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.25000000000000007e50 or 0.030499999999999999 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6464.7
Applied rewrites64.7%
if -2.25000000000000007e50 < y < 0.030499999999999999Initial 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-+.f6498.0
Applied rewrites98.0%
Final simplification82.8%
(FPCore (x y z) :precision binary64 (if (<= y -8.2e+17) (+ x 1.0) (if (<= y 4.4e+15) (fma y (- (* y -0.5) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.2e+17) {
tmp = x + 1.0;
} else if (y <= 4.4e+15) {
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 <= -8.2e+17) tmp = Float64(x + 1.0); elseif (y <= 4.4e+15) 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, -8.2e+17], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 4.4e+15], 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 -8.2 \cdot 10^{+17}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -8.2e17 or 4.4e15 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6443.8
Applied rewrites43.8%
if -8.2e17 < y < 4.4e15Initial 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-+.f6498.6
Applied rewrites98.6%
(FPCore (x y z) :precision binary64 (if (<= y -2.75e+20) (+ x 1.0) (if (<= y 2.65e+67) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.75e+20) {
tmp = x + 1.0;
} else if (y <= 2.65e+67) {
tmp = x - fma(y, z, -1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2.75e+20) tmp = Float64(x + 1.0); elseif (y <= 2.65e+67) 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, -2.75e+20], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2.65e+67], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{+20}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{+67}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.75e20 or 2.65e67 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6442.1
Applied rewrites42.1%
if -2.75e20 < y < 2.65e67Initial 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.f6495.6
Applied rewrites95.6%
(FPCore (x y z) :precision binary64 (if (<= x -8.2e-9) (+ x 1.0) (if (<= x 0.48) (fma z (- y) 1.0) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.2e-9) {
tmp = x + 1.0;
} else if (x <= 0.48) {
tmp = fma(z, -y, 1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -8.2e-9) tmp = Float64(x + 1.0); elseif (x <= 0.48) tmp = fma(z, Float64(-y), 1.0); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -8.2e-9], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 0.48], N[(z * (-y) + 1.0), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-9}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 0.48:\\
\;\;\;\;\mathsf{fma}\left(z, -y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -8.2000000000000006e-9 or 0.47999999999999998 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6488.6
Applied rewrites88.6%
if -8.2000000000000006e-9 < x < 0.47999999999999998Initial program 99.9%
lift-cos.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-*.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.7
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
Applied rewrites99.7%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-+.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
lft-mult-inverseN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
distribute-lft-inN/A
rgt-mult-inverseN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6451.7
Applied rewrites51.7%
(FPCore (x y z) :precision binary64 (if (<= z 1.8e+206) (+ x 1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.8e+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 <= 1.8d+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 <= 1.8e+206) {
tmp = x + 1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.8e+206: tmp = x + 1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.8e+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 <= 1.8e+206) tmp = x + 1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.8e+206], N[(x + 1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+206}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 1.80000000000000014e206Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6470.3
Applied rewrites70.3%
if 1.80000000000000014e206 < z Initial program 99.9%
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.f6458.6
Applied rewrites58.6%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6440.0
Applied rewrites40.0%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6441.7
Applied rewrites41.7%
Final simplification67.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-+.f6465.3
Applied rewrites65.3%
(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-+.f6465.3
Applied rewrites65.3%
Taylor expanded in x around 0
Applied rewrites20.6%
herbie shell --seed 2024219
(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))))