
(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 (fma (- z) (sin y) (cos y))))
double code(double x, double y, double z) {
return x + fma(-z, sin(y), cos(y));
}
function code(x, y, z) return Float64(x + fma(Float64(-z), sin(y), cos(y))) end
code[x_, y_, z_] := N[(x + N[((-z) * N[Sin[y], $MachinePrecision] + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(-z, \sin y, \cos y\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) z)) (t_1 (- (+ x (cos y)) t_0)))
(if (<= t_1 -2e+27)
(+ (* (- (sin y)) z) x)
(if (<= t_1 0.998) (- (cos y) t_0) (- (+ 1.0 x) t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double t_1 = (x + cos(y)) - t_0;
double tmp;
if (t_1 <= -2e+27) {
tmp = (-sin(y) * z) + x;
} else if (t_1 <= 0.998) {
tmp = cos(y) - t_0;
} else {
tmp = (1.0 + x) - 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 = sin(y) * z
t_1 = (x + cos(y)) - t_0
if (t_1 <= (-2d+27)) then
tmp = (-sin(y) * z) + x
else if (t_1 <= 0.998d0) then
tmp = cos(y) - t_0
else
tmp = (1.0d0 + x) - 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 t_1 = (x + Math.cos(y)) - t_0;
double tmp;
if (t_1 <= -2e+27) {
tmp = (-Math.sin(y) * z) + x;
} else if (t_1 <= 0.998) {
tmp = Math.cos(y) - t_0;
} else {
tmp = (1.0 + x) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * z t_1 = (x + math.cos(y)) - t_0 tmp = 0 if t_1 <= -2e+27: tmp = (-math.sin(y) * z) + x elif t_1 <= 0.998: tmp = math.cos(y) - t_0 else: tmp = (1.0 + x) - t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * z) t_1 = Float64(Float64(x + cos(y)) - t_0) tmp = 0.0 if (t_1 <= -2e+27) tmp = Float64(Float64(Float64(-sin(y)) * z) + x); elseif (t_1 <= 0.998) tmp = Float64(cos(y) - t_0); else tmp = Float64(Float64(1.0 + x) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * z; t_1 = (x + cos(y)) - t_0; tmp = 0.0; if (t_1 <= -2e+27) tmp = (-sin(y) * z) + x; elseif (t_1 <= 0.998) tmp = cos(y) - t_0; else tmp = (1.0 + x) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+27], N[(N[((-N[Sin[y], $MachinePrecision]) * z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.998], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
t_1 := \left(x + \cos y\right) - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+27}:\\
\;\;\;\;\left(-\sin y\right) \cdot z + x\\
\mathbf{elif}\;t\_1 \leq 0.998:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x\right) - t\_0\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -2e27Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites99.9%
if -2e27 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.998Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6499.2
Applied rewrites99.2%
if 0.998 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.3%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x (cos y)) (* (sin y) z))) (t_1 (+ (* (- (sin y)) z) x))) (if (<= t_0 -5e+19) t_1 (if (<= t_0 2.0) (- (cos y) (* y z)) t_1))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (sin(y) * z);
double t_1 = (-sin(y) * z) + x;
double tmp;
if (t_0 <= -5e+19) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = cos(y) - (y * z);
} else {
tmp = t_1;
}
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 = (x + cos(y)) - (sin(y) * z)
t_1 = (-sin(y) * z) + x
if (t_0 <= (-5d+19)) then
tmp = t_1
else if (t_0 <= 2.0d0) then
tmp = cos(y) - (y * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.cos(y)) - (Math.sin(y) * z);
double t_1 = (-Math.sin(y) * z) + x;
double tmp;
if (t_0 <= -5e+19) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = Math.cos(y) - (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.cos(y)) - (math.sin(y) * z) t_1 = (-math.sin(y) * z) + x tmp = 0 if t_0 <= -5e+19: tmp = t_1 elif t_0 <= 2.0: tmp = math.cos(y) - (y * z) 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(Float64(Float64(-sin(y)) * z) + x) tmp = 0.0 if (t_0 <= -5e+19) tmp = t_1; elseif (t_0 <= 2.0) tmp = Float64(cos(y) - Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + cos(y)) - (sin(y) * z); t_1 = (-sin(y) * z) + x; tmp = 0.0; if (t_0 <= -5e+19) tmp = t_1; elseif (t_0 <= 2.0) tmp = cos(y) - (y * z); else tmp = t_1; end tmp_2 = 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[(N[((-N[Sin[y], $MachinePrecision]) * z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+19], t$95$1, If[LessEqual[t$95$0, 2.0], N[(N[Cos[y], $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - \sin y \cdot z\\
t_1 := \left(-\sin y\right) \cdot z + x\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\cos y - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -5e19 or 2 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites98.4%
if -5e19 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 2Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f6483.5
Applied rewrites83.5%
Taylor expanded in x around 0
lower-cos.f6483.5
Applied rewrites83.5%
Final simplification93.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ 1.0 x) (* (sin y) z)))) (if (<= z -2.25e+18) t_0 (if (<= z 0.36) (+ (* (/ (cos y) z) z) x) t_0))))
double code(double x, double y, double z) {
double t_0 = (1.0 + x) - (sin(y) * z);
double tmp;
if (z <= -2.25e+18) {
tmp = t_0;
} else if (z <= 0.36) {
tmp = ((cos(y) / z) * z) + x;
} 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 = (1.0d0 + x) - (sin(y) * z)
if (z <= (-2.25d+18)) then
tmp = t_0
else if (z <= 0.36d0) then
tmp = ((cos(y) / z) * z) + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (1.0 + x) - (Math.sin(y) * z);
double tmp;
if (z <= -2.25e+18) {
tmp = t_0;
} else if (z <= 0.36) {
tmp = ((Math.cos(y) / z) * z) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 + x) - (math.sin(y) * z) tmp = 0 if z <= -2.25e+18: tmp = t_0 elif z <= 0.36: tmp = ((math.cos(y) / z) * z) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 + x) - Float64(sin(y) * z)) tmp = 0.0 if (z <= -2.25e+18) tmp = t_0; elseif (z <= 0.36) tmp = Float64(Float64(Float64(cos(y) / z) * z) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 + x) - (sin(y) * z); tmp = 0.0; if (z <= -2.25e+18) tmp = t_0; elseif (z <= 0.36) tmp = ((cos(y) / z) * z) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 + x), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.25e+18], t$95$0, If[LessEqual[z, 0.36], N[(N[(N[(N[Cos[y], $MachinePrecision] / z), $MachinePrecision] * z), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + x\right) - \sin y \cdot z\\
\mathbf{if}\;z \leq -2.25 \cdot 10^{+18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.36:\\
\;\;\;\;\frac{\cos y}{z} \cdot z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.25e18 or 0.35999999999999999 < z Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites99.8%
if -2.25e18 < z < 0.35999999999999999Initial program 100.0%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
+-commutativeN/A
lower-+.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites81.4%
Taylor expanded in z around 0
Applied rewrites99.0%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (sin y)) z)))
(if (<= y -7000000.0)
t_0
(if (<= y 7.4)
(fma (- (* (fma 0.16666666666666666 (* y z) -0.5) y) z) y (+ 1.0 x))
t_0))))
double code(double x, double y, double z) {
double t_0 = -sin(y) * z;
double tmp;
if (y <= -7000000.0) {
tmp = t_0;
} else if (y <= 7.4) {
tmp = fma(((fma(0.16666666666666666, (y * z), -0.5) * y) - z), y, (1.0 + x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(-sin(y)) * z) tmp = 0.0 if (y <= -7000000.0) tmp = t_0; elseif (y <= 7.4) tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(y * z), -0.5) * y) - z), y, Float64(1.0 + x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[((-N[Sin[y], $MachinePrecision]) * z), $MachinePrecision]}, If[LessEqual[y, -7000000.0], t$95$0, If[LessEqual[y, 7.4], N[(N[(N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision] + -0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\sin y\right) \cdot z\\
\mathbf{if}\;y \leq -7000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 7.4:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y \cdot z, -0.5\right) \cdot y - z, y, 1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7e6 or 7.4000000000000004 < 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.f6450.2
Applied rewrites50.2%
if -7e6 < y < 7.4000000000000004Initial program 100.0%
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-+.f6499.9
Applied rewrites99.9%
Final simplification78.5%
(FPCore (x y z) :precision binary64 (- (+ 1.0 x) (* (sin y) z)))
double code(double x, double y, double z) {
return (1.0 + x) - (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 = (1.0d0 + x) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (1.0 + x) - (Math.sin(y) * z);
}
def code(x, y, z): return (1.0 + x) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(1.0 + x) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (1.0 + x) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(1.0 + x), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + x\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites91.3%
Final simplification91.3%
(FPCore (x y z)
:precision binary64
(if (<= y -230000.0)
(+ 1.0 x)
(if (<= y 530000.0)
(fma (- (* (fma 0.16666666666666666 (* y z) -0.5) y) z) y (+ 1.0 x))
(+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -230000.0) {
tmp = 1.0 + x;
} else if (y <= 530000.0) {
tmp = fma(((fma(0.16666666666666666, (y * z), -0.5) * y) - z), y, (1.0 + x));
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -230000.0) tmp = Float64(1.0 + x); elseif (y <= 530000.0) tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(y * z), -0.5) * y) - z), y, Float64(1.0 + x)); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -230000.0], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 530000.0], N[(N[(N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision] + -0.5), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -230000:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 530000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, y \cdot z, -0.5\right) \cdot y - z, y, 1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -2.3e5 or 5.3e5 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6433.3
Applied rewrites33.3%
if -2.3e5 < y < 5.3e5Initial program 100.0%
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-+.f6499.3
Applied rewrites99.3%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.04e+104) (+ 1.0 x) (if (<= y 5.5e+17) (fma (- (* -0.5 y) z) y (+ 1.0 x)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.04e+104) {
tmp = 1.0 + x;
} else if (y <= 5.5e+17) {
tmp = fma(((-0.5 * y) - z), y, (1.0 + x));
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.04e+104) tmp = Float64(1.0 + x); elseif (y <= 5.5e+17) tmp = fma(Float64(Float64(-0.5 * y) - z), y, Float64(1.0 + x)); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.04e+104], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 5.5e+17], N[(N[(N[(-0.5 * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.04 \cdot 10^{+104}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -1.0400000000000001e104 or 5.5e17 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6434.1
Applied rewrites34.1%
if -1.0400000000000001e104 < y < 5.5e17Initial 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-+.f6492.1
Applied rewrites92.1%
(FPCore (x y z) :precision binary64 (if (<= y -3350000000000.0) (+ 1.0 x) (if (<= y 1.8e+69) (- x (fma z y -1.0)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3350000000000.0) {
tmp = 1.0 + x;
} else if (y <= 1.8e+69) {
tmp = x - fma(z, y, -1.0);
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3350000000000.0) tmp = Float64(1.0 + x); elseif (y <= 1.8e+69) tmp = Float64(x - fma(z, y, -1.0)); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3350000000000.0], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 1.8e+69], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3350000000000:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -3.35e12 or 1.8000000000000001e69 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6433.5
Applied rewrites33.5%
if -3.35e12 < y < 1.8000000000000001e69Initial 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.f6495.3
Applied rewrites95.3%
(FPCore (x y z) :precision binary64 (if (<= x -1.08e-10) (+ 1.0 x) (if (<= x 1.8e-25) (fma (- z) y 1.0) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.08e-10) {
tmp = 1.0 + x;
} else if (x <= 1.8e-25) {
tmp = fma(-z, y, 1.0);
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.08e-10) tmp = Float64(1.0 + x); elseif (x <= 1.8e-25) tmp = fma(Float64(-z), y, 1.0); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.08e-10], N[(1.0 + x), $MachinePrecision], If[LessEqual[x, 1.8e-25], N[((-z) * y + 1.0), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08 \cdot 10^{-10}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if x < -1.08000000000000002e-10 or 1.8e-25 < x Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6477.0
Applied rewrites77.0%
if -1.08000000000000002e-10 < x < 1.8e-25Initial 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-+.f6457.5
Applied rewrites57.5%
Taylor expanded in x around 0
Applied rewrites57.5%
Taylor expanded in y around 0
Applied rewrites58.3%
(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-+.f6461.5
Applied rewrites61.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-+.f6461.5
Applied rewrites61.5%
Taylor expanded in x around 0
Applied rewrites27.3%
herbie shell --seed 2024308
(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))))