
(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 (- (+ (cos y) x) (* (sin y) z)))
double code(double x, double y, double z) {
return (cos(y) + 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 = (cos(y) + x) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (Math.cos(y) + x) - (Math.sin(y) * z);
}
def code(x, y, z): return (math.cos(y) + x) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(cos(y) + x) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (cos(y) + x) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos y + x\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ (cos y) x) (* (sin y) z))) (t_1 (- x (fma z y -1.0)))) (if (<= t_0 -40.0) t_1 (if (<= t_0 0.9995) (cos y) t_1))))
double code(double x, double y, double z) {
double t_0 = (cos(y) + x) - (sin(y) * z);
double t_1 = x - fma(z, y, -1.0);
double tmp;
if (t_0 <= -40.0) {
tmp = t_1;
} else if (t_0 <= 0.9995) {
tmp = cos(y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(cos(y) + x) - Float64(sin(y) * z)) t_1 = Float64(x - fma(z, y, -1.0)) tmp = 0.0 if (t_0 <= -40.0) tmp = t_1; elseif (t_0 <= 0.9995) tmp = cos(y); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -40.0], t$95$1, If[LessEqual[t$95$0, 0.9995], N[Cos[y], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\cos y + x\right) - \sin y \cdot z\\
t_1 := x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{if}\;t\_0 \leq -40:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.9995:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -40 or 0.99950000000000006 < (-.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
*-commutativeN/A
metadata-evalN/A
lower-fma.f6471.1
Applied rewrites71.1%
if -40 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 0.99950000000000006Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6492.0
Applied rewrites92.0%
Taylor expanded in x around 0
Applied rewrites86.7%
Final simplification73.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (sin y) z)) (t_1 (- (+ 1.0 x) t_0))) (if (<= x -8.5e-16) t_1 (if (<= x 1.65e-7) (- (cos y) t_0) t_1))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double t_1 = (1.0 + x) - t_0;
double tmp;
if (x <= -8.5e-16) {
tmp = t_1;
} else if (x <= 1.65e-7) {
tmp = cos(y) - t_0;
} 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 = sin(y) * z
t_1 = (1.0d0 + x) - t_0
if (x <= (-8.5d-16)) then
tmp = t_1
else if (x <= 1.65d-7) then
tmp = cos(y) - t_0
else
tmp = t_1
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 = (1.0 + x) - t_0;
double tmp;
if (x <= -8.5e-16) {
tmp = t_1;
} else if (x <= 1.65e-7) {
tmp = Math.cos(y) - t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * z t_1 = (1.0 + x) - t_0 tmp = 0 if x <= -8.5e-16: tmp = t_1 elif x <= 1.65e-7: tmp = math.cos(y) - t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * z) t_1 = Float64(Float64(1.0 + x) - t_0) tmp = 0.0 if (x <= -8.5e-16) tmp = t_1; elseif (x <= 1.65e-7) tmp = Float64(cos(y) - t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * z; t_1 = (1.0 + x) - t_0; tmp = 0.0; if (x <= -8.5e-16) tmp = t_1; elseif (x <= 1.65e-7) tmp = cos(y) - t_0; else tmp = t_1; 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[(1.0 + x), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[x, -8.5e-16], t$95$1, If[LessEqual[x, 1.65e-7], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
t_1 := \left(1 + x\right) - t\_0\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-7}:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.5000000000000001e-16 or 1.6500000000000001e-7 < x Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites98.8%
if -8.5000000000000001e-16 < x < 1.6500000000000001e-7Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6499.5
Applied rewrites99.5%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ 1.0 x) (* (sin y) z)))) (if (<= z -12.0) t_0 (if (<= z 1.05e-10) (+ (cos y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = (1.0 + x) - (sin(y) * z);
double tmp;
if (z <= -12.0) {
tmp = t_0;
} else if (z <= 1.05e-10) {
tmp = cos(y) + 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 <= (-12.0d0)) then
tmp = t_0
else if (z <= 1.05d-10) then
tmp = cos(y) + 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 <= -12.0) {
tmp = t_0;
} else if (z <= 1.05e-10) {
tmp = Math.cos(y) + 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 <= -12.0: tmp = t_0 elif z <= 1.05e-10: tmp = math.cos(y) + 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 <= -12.0) tmp = t_0; elseif (z <= 1.05e-10) tmp = Float64(cos(y) + 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 <= -12.0) tmp = t_0; elseif (z <= 1.05e-10) tmp = cos(y) + 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, -12.0], t$95$0, If[LessEqual[z, 1.05e-10], N[(N[Cos[y], $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 -12:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -12 or 1.05e-10 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.5%
if -12 < z < 1.05e-10Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6498.1
Applied rewrites98.1%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (- z) (sin y)))) (if (<= z -3.1e+117) t_0 (if (<= z 6.8e+47) (+ (cos y) x) t_0))))
double code(double x, double y, double z) {
double t_0 = -z * sin(y);
double tmp;
if (z <= -3.1e+117) {
tmp = t_0;
} else if (z <= 6.8e+47) {
tmp = cos(y) + 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 = -z * sin(y)
if (z <= (-3.1d+117)) then
tmp = t_0
else if (z <= 6.8d+47) then
tmp = cos(y) + x
else
tmp = 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 tmp;
if (z <= -3.1e+117) {
tmp = t_0;
} else if (z <= 6.8e+47) {
tmp = Math.cos(y) + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -z * math.sin(y) tmp = 0 if z <= -3.1e+117: tmp = t_0 elif z <= 6.8e+47: tmp = math.cos(y) + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) * sin(y)) tmp = 0.0 if (z <= -3.1e+117) tmp = t_0; elseif (z <= 6.8e+47) tmp = Float64(cos(y) + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -z * sin(y); tmp = 0.0; if (z <= -3.1e+117) tmp = t_0; elseif (z <= 6.8e+47) tmp = cos(y) + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+117], t$95$0, If[LessEqual[z, 6.8e+47], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) \cdot \sin y\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+117}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+47}:\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.09999999999999975e117 or 6.7999999999999996e47 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6465.3
Applied rewrites65.3%
if -3.09999999999999975e117 < z < 6.7999999999999996e47Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6494.3
Applied rewrites94.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (cos y) x)))
(if (<= y -950.0)
t_0
(if (<= y 0.9)
(-
(+ 1.0 x)
(*
(fma
(* (fma 0.008333333333333333 (* y y) -0.16666666666666666) z)
(* y y)
z)
y))
t_0))))
double code(double x, double y, double z) {
double t_0 = cos(y) + x;
double tmp;
if (y <= -950.0) {
tmp = t_0;
} else if (y <= 0.9) {
tmp = (1.0 + x) - (fma((fma(0.008333333333333333, (y * y), -0.16666666666666666) * z), (y * y), z) * y);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(cos(y) + x) tmp = 0.0 if (y <= -950.0) tmp = t_0; elseif (y <= 0.9) tmp = Float64(Float64(1.0 + x) - Float64(fma(Float64(fma(0.008333333333333333, Float64(y * y), -0.16666666666666666) * z), Float64(y * y), z) * y)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -950.0], t$95$0, If[LessEqual[y, 0.9], N[(N[(1.0 + x), $MachinePrecision] - N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * z), $MachinePrecision] * N[(y * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y + x\\
\mathbf{if}\;y \leq -950:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.9:\\
\;\;\;\;\left(1 + x\right) - \mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right) \cdot z, y \cdot y, z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -950 or 0.900000000000000022 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6461.7
Applied rewrites61.7%
if -950 < y < 0.900000000000000022Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Final simplification80.5%
(FPCore (x y z)
:precision binary64
(if (<= y -1.25e+24)
(+ 1.0 x)
(if (<= y 3.15)
(-
(+ 1.0 x)
(*
(fma
(* (fma 0.008333333333333333 (* y y) -0.16666666666666666) z)
(* y y)
z)
y))
(+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e+24) {
tmp = 1.0 + x;
} else if (y <= 3.15) {
tmp = (1.0 + x) - (fma((fma(0.008333333333333333, (y * y), -0.16666666666666666) * z), (y * y), z) * y);
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.25e+24) tmp = Float64(1.0 + x); elseif (y <= 3.15) tmp = Float64(Float64(1.0 + x) - Float64(fma(Float64(fma(0.008333333333333333, Float64(y * y), -0.16666666666666666) * z), Float64(y * y), z) * y)); else tmp = Float64(1.0 + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -1.25e+24], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 3.15], N[(N[(1.0 + x), $MachinePrecision] - N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * z), $MachinePrecision] * N[(y * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+24}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 3.15:\\
\;\;\;\;\left(1 + x\right) - \mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, -0.16666666666666666\right) \cdot z, y \cdot y, z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -1.25000000000000011e24 or 3.14999999999999991 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6442.6
Applied rewrites42.6%
if -1.25000000000000011e24 < y < 3.14999999999999991Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.3%
Final simplification70.8%
(FPCore (x y z)
:precision binary64
(if (<= y -4.6)
(+ 1.0 x)
(if (<= y 11.0)
(fma (- (* (fma 0.16666666666666666 (* z y) -0.5) y) z) y (+ 1.0 x))
(+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.6) {
tmp = 1.0 + x;
} else if (y <= 11.0) {
tmp = fma(((fma(0.16666666666666666, (z * y), -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 <= -4.6) tmp = Float64(1.0 + x); elseif (y <= 11.0) tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(z * y), -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, -4.6], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 11.0], N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $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 -4.6:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 11:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5\right) \cdot y - z, y, 1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -4.5999999999999996 or 11 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6442.4
Applied rewrites42.4%
if -4.5999999999999996 < y < 11Initial 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%
(FPCore (x y z) :precision binary64 (if (<= y -5.5e+44) (+ 1.0 x) (if (<= y 3.15) (- x (fma z y -1.0)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+44) {
tmp = 1.0 + x;
} else if (y <= 3.15) {
tmp = x - fma(z, y, -1.0);
} else {
tmp = 1.0 + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -5.5e+44) tmp = Float64(1.0 + x); elseif (y <= 3.15) 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, -5.5e+44], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 3.15], N[(x - N[(z * y + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+44}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 3.15:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -5.5000000000000001e44 or 3.14999999999999991 < y Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6442.9
Applied rewrites42.9%
if -5.5000000000000001e44 < y < 3.14999999999999991Initial 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.f6496.4
Applied rewrites96.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.26e+272) (* (- z) y) (+ 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.26e+272) {
tmp = -z * 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 <= (-1.26d+272)) then
tmp = -z * 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 <= -1.26e+272) {
tmp = -z * y;
} else {
tmp = 1.0 + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.26e+272: tmp = -z * y else: tmp = 1.0 + x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.26e+272) tmp = Float64(Float64(-z) * y); else tmp = Float64(1.0 + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.26e+272) tmp = -z * y; else tmp = 1.0 + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.26e+272], N[((-z) * y), $MachinePrecision], N[(1.0 + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.26 \cdot 10^{+272}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if z < -1.26e272Initial 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-+.f6461.2
Applied rewrites61.2%
Taylor expanded in z around inf
Applied rewrites52.8%
if -1.26e272 < z Initial program 99.9%
Taylor expanded in y around 0
lower-+.f6462.2
Applied rewrites62.2%
(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.0
Applied rewrites60.0%
(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.0
Applied rewrites60.0%
Taylor expanded in x around 0
Applied rewrites20.0%
herbie shell --seed 2024276
(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))))