
(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 13 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 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))) (t_1 (* (sin y) z)) (t_2 (- t_0 t_1)))
(if (<= t_2 -100.0)
(- (+ x 1.0) t_1)
(if (<= t_2 0.9998) t_0 (fma (sin y) (- z) (+ x 1.0))))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = sin(y) * z;
double t_2 = t_0 - t_1;
double tmp;
if (t_2 <= -100.0) {
tmp = (x + 1.0) - t_1;
} else if (t_2 <= 0.9998) {
tmp = t_0;
} else {
tmp = fma(sin(y), -z, (x + 1.0));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(sin(y) * z) t_2 = Float64(t_0 - t_1) tmp = 0.0 if (t_2 <= -100.0) tmp = Float64(Float64(x + 1.0) - t_1); elseif (t_2 <= 0.9998) tmp = t_0; else tmp = fma(sin(y), Float64(-z), Float64(x + 1.0)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -100.0], N[(N[(x + 1.0), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.9998], t$95$0, N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := \sin y \cdot z\\
t_2 := t\_0 - t\_1\\
\mathbf{if}\;t\_2 \leq -100:\\
\;\;\;\;\left(x + 1\right) - t\_1\\
\mathbf{elif}\;t\_2 \leq 0.9998:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x + 1\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -100Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.2%
if -100 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99980000000000002Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f64100.0
Applied rewrites100.0%
if 0.99980000000000002 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y)))
(t_1 (* (sin y) z))
(t_2 (- t_0 t_1))
(t_3 (- (+ x 1.0) t_1)))
(if (<= t_2 -100.0) t_3 (if (<= t_2 0.9998) t_0 t_3))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = sin(y) * z;
double t_2 = t_0 - t_1;
double t_3 = (x + 1.0) - t_1;
double tmp;
if (t_2 <= -100.0) {
tmp = t_3;
} else if (t_2 <= 0.9998) {
tmp = t_0;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = x + cos(y)
t_1 = sin(y) * z
t_2 = t_0 - t_1
t_3 = (x + 1.0d0) - t_1
if (t_2 <= (-100.0d0)) then
tmp = t_3
else if (t_2 <= 0.9998d0) then
tmp = t_0
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double t_1 = Math.sin(y) * z;
double t_2 = t_0 - t_1;
double t_3 = (x + 1.0) - t_1;
double tmp;
if (t_2 <= -100.0) {
tmp = t_3;
} else if (t_2 <= 0.9998) {
tmp = t_0;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) t_1 = math.sin(y) * z t_2 = t_0 - t_1 t_3 = (x + 1.0) - t_1 tmp = 0 if t_2 <= -100.0: tmp = t_3 elif t_2 <= 0.9998: tmp = t_0 else: tmp = t_3 return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(sin(y) * z) t_2 = Float64(t_0 - t_1) t_3 = Float64(Float64(x + 1.0) - t_1) tmp = 0.0 if (t_2 <= -100.0) tmp = t_3; elseif (t_2 <= 0.9998) tmp = t_0; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); t_1 = sin(y) * z; t_2 = t_0 - t_1; t_3 = (x + 1.0) - t_1; tmp = 0.0; if (t_2 <= -100.0) tmp = t_3; elseif (t_2 <= 0.9998) tmp = t_0; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + 1.0), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -100.0], t$95$3, If[LessEqual[t$95$2, 0.9998], t$95$0, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := \sin y \cdot z\\
t_2 := t\_0 - t\_1\\
t_3 := \left(x + 1\right) - t\_1\\
\mathbf{if}\;t\_2 \leq -100:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0.9998:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -100 or 0.99980000000000002 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.6%
if -100 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99980000000000002Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f64100.0
Applied rewrites100.0%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x (cos y)) (* (sin y) z))) (t_1 (- x (fma y z -1.0)))) (if (<= t_0 -100.0) t_1 (if (<= t_0 0.9998) (cos y) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (sin(y) * z);
double t_1 = x - fma(y, z, -1.0);
double tmp;
if (t_0 <= -100.0) {
tmp = t_1;
} else if (t_0 <= 0.9998) {
tmp = cos(y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) t_1 = Float64(x - fma(y, z, -1.0)) tmp = 0.0 if (t_0 <= -100.0) tmp = t_1; elseif (t_0 <= 0.9998) 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[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -100.0], t$95$1, If[LessEqual[t$95$0, 0.9998], N[Cos[y], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - \sin y \cdot z\\
t_1 := x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{if}\;t\_0 \leq -100:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.9998:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -100 or 0.99980000000000002 < (-.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.f6471.4
Applied rewrites71.4%
if -100 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99980000000000002Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites87.9%
Final simplification73.5%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* (sin y) z)))
double code(double x, double y, double z) {
return (x + cos(y)) - (sin(y) * z);
}
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)) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (Math.sin(y) * z);
}
def code(x, y, z): return (x + math.cos(y)) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (* (sin y) z)))) (if (<= z -5.2e+97) t_0 (if (<= z 3.5e+120) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = -(sin(y) * z);
double tmp;
if (z <= -5.2e+97) {
tmp = t_0;
} else if (z <= 3.5e+120) {
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 <= (-5.2d+97)) then
tmp = t_0
else if (z <= 3.5d+120) 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 <= -5.2e+97) {
tmp = t_0;
} else if (z <= 3.5e+120) {
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 <= -5.2e+97: tmp = t_0 elif z <= 3.5e+120: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-Float64(sin(y) * z)) tmp = 0.0 if (z <= -5.2e+97) tmp = t_0; elseif (z <= 3.5e+120) 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 <= -5.2e+97) tmp = t_0; elseif (z <= 3.5e+120) 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, -5.2e+97], t$95$0, If[LessEqual[z, 3.5e+120], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\sin y \cdot z\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+97}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+120}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -5.2e97 or 3.50000000000000007e120 < z Initial program 99.7%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f6468.5
Applied rewrites68.5%
if -5.2e97 < z < 3.50000000000000007e120Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6493.8
Applied rewrites93.8%
Final simplification85.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -1.25)
t_0
(if (<= y 2.8)
(-
(+ x 1.0)
(*
y
(fma
(* y (* y z))
(fma
(* y y)
(fma (* y y) -0.0001984126984126984 0.008333333333333333)
-0.16666666666666666)
z)))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -1.25) {
tmp = t_0;
} else if (y <= 2.8) {
tmp = (x + 1.0) - (y * fma((y * (y * z)), fma((y * y), fma((y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666), z));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -1.25) tmp = t_0; elseif (y <= 2.8) tmp = Float64(Float64(x + 1.0) - Float64(y * fma(Float64(y * Float64(y * z)), fma(Float64(y * y), fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666), z))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.25], t$95$0, If[LessEqual[y, 2.8], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(N[(y * N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -1.25:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.8:\\
\;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y \cdot \left(y \cdot z\right), \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.25 or 2.7999999999999998 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6460.4
Applied rewrites60.4%
if -1.25 < y < 2.7999999999999998Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites99.4%
Final simplification80.5%
(FPCore (x y z)
:precision binary64
(if (<= y -2.3e+21)
(+ x 1.0)
(if (<= y 3e+18)
(+ 1.0 (fma y (fma y (fma y (* z 0.16666666666666666) -0.5) (- z)) x))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.3e+21) {
tmp = x + 1.0;
} else if (y <= 3e+18) {
tmp = 1.0 + fma(y, fma(y, fma(y, (z * 0.16666666666666666), -0.5), -z), x);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -2.3e+21) tmp = Float64(x + 1.0); elseif (y <= 3e+18) tmp = Float64(1.0 + fma(y, fma(y, fma(y, Float64(z * 0.16666666666666666), -0.5), Float64(-z)), x)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -2.3e+21], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 3e+18], N[(1.0 + N[(y * N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision] + (-z)), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+21}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+18}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot 0.16666666666666666, -0.5\right), -z\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.3e21 or 3e18 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6437.6
Applied rewrites37.6%
if -2.3e21 < y < 3e18Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
lower-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6496.0
Applied rewrites96.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.1e+20) (+ x 1.0) (if (<= y 3.9e+35) (fma y (- (* y -0.5) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.1e+20) {
tmp = x + 1.0;
} else if (y <= 3.9e+35) {
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 <= -2.1e+20) tmp = Float64(x + 1.0); elseif (y <= 3.9e+35) 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, -2.1e+20], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 3.9e+35], 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 -2.1 \cdot 10^{+20}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.1e20 or 3.8999999999999999e35 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6437.9
Applied rewrites37.9%
if -2.1e20 < y < 3.8999999999999999e35Initial 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-+.f6495.2
Applied rewrites95.2%
(FPCore (x y z) :precision binary64 (if (<= y -13500000.0) (+ x 1.0) (if (<= y 2.45e+54) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -13500000.0) {
tmp = x + 1.0;
} else if (y <= 2.45e+54) {
tmp = x - fma(y, z, -1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -13500000.0) tmp = Float64(x + 1.0); elseif (y <= 2.45e+54) 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, -13500000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2.45e+54], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -13500000:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{+54}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.35e7 or 2.45e54 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6440.5
Applied rewrites40.5%
if -1.35e7 < y < 2.45e54Initial 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.f6493.7
Applied rewrites93.7%
(FPCore (x y z) :precision binary64 (if (<= z 1.8e+155) (+ x 1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.8e+155) {
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+155) 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+155) {
tmp = x + 1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.8e+155: tmp = x + 1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.8e+155) 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+155) tmp = x + 1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.8e+155], N[(x + 1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 1.80000000000000004e155Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6469.2
Applied rewrites69.2%
if 1.80000000000000004e155 < z Initial program 99.7%
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-+.f6439.0
Applied rewrites39.0%
Taylor expanded in z around inf
Applied rewrites27.9%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6461.1
Applied rewrites61.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
+-commutativeN/A
lower-+.f6461.1
Applied rewrites61.1%
Taylor expanded in x around 0
Applied rewrites23.3%
herbie shell --seed 2024234
(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))))