
(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
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -9000000.0)
(fma (sin y) (- z) (+ 1.0 x))
(if (<= x 7.2e-46)
(fma (sin y) (- z) (cos y))
(- (+ 1.0 x) (* z (sin y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -9000000.0) {
tmp = fma(sin(y), -z, (1.0 + x));
} else if (x <= 7.2e-46) {
tmp = fma(sin(y), -z, cos(y));
} else {
tmp = (1.0 + x) - (z * sin(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -9000000.0) tmp = fma(sin(y), Float64(-z), Float64(1.0 + x)); elseif (x <= 7.2e-46) tmp = fma(sin(y), Float64(-z), cos(y)); else tmp = Float64(Float64(1.0 + x) - Float64(z * sin(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -9000000.0], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], N[(N[Sin[y], $MachinePrecision] * (-z) + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9000000:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, \cos y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x\right) - z \cdot \sin y\\
\end{array}
\end{array}
if x < -9e6Initial 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
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
if -9e6 < x < 7.2e-46Initial 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
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-cos.f6498.8
Applied rewrites98.8%
if 7.2e-46 < x Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.2%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (<= x -9000000.0)
(fma (sin y) (- z) (+ 1.0 x))
(if (<= x 7.2e-46) (- (cos y) t_0) (- (+ 1.0 x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if (x <= -9000000.0) {
tmp = fma(sin(y), -z, (1.0 + x));
} else if (x <= 7.2e-46) {
tmp = cos(y) - t_0;
} else {
tmp = (1.0 + x) - t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if (x <= -9000000.0) tmp = fma(sin(y), Float64(-z), Float64(1.0 + x)); elseif (x <= 7.2e-46) tmp = Float64(cos(y) - t_0); else tmp = Float64(Float64(1.0 + x) - t_0); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9000000.0], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], 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 := z \cdot \sin y\\
\mathbf{if}\;x \leq -9000000:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x\right) - t\_0\\
\end{array}
\end{array}
if x < -9e6Initial 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
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
if -9e6 < x < 7.2e-46Initial program 99.9%
Taylor expanded in x around 0
lower-cos.f6498.8
Applied rewrites98.8%
if 7.2e-46 < x Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites99.2%
Final simplification99.2%
(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 (fma (sin y) (- z) (+ 1.0 x)))) (if (<= z -265.0) t_0 (if (<= z 1.4) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(sin(y), -z, (1.0 + x));
double tmp;
if (z <= -265.0) {
tmp = t_0;
} else if (z <= 1.4) {
tmp = x + cos(y);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(sin(y), Float64(-z), Float64(1.0 + x)) tmp = 0.0 if (z <= -265.0) tmp = t_0; elseif (z <= 1.4) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z) + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -265.0], t$95$0, If[LessEqual[z, 1.4], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sin y, -z, 1 + x\right)\\
\mathbf{if}\;z \leq -265:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.4:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -265 or 1.3999999999999999 < z Initial program 99.8%
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.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites99.2%
if -265 < z < 1.3999999999999999Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6498.4
Applied rewrites98.4%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ 1.0 x) (* z (sin y))))) (if (<= z -265.0) t_0 (if (<= z 1.4) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (1.0 + x) - (z * sin(y));
double tmp;
if (z <= -265.0) {
tmp = t_0;
} else if (z <= 1.4) {
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 = (1.0d0 + x) - (z * sin(y))
if (z <= (-265.0d0)) then
tmp = t_0
else if (z <= 1.4d0) 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 = (1.0 + x) - (z * Math.sin(y));
double tmp;
if (z <= -265.0) {
tmp = t_0;
} else if (z <= 1.4) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 + x) - (z * math.sin(y)) tmp = 0 if z <= -265.0: tmp = t_0 elif z <= 1.4: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 + x) - Float64(z * sin(y))) tmp = 0.0 if (z <= -265.0) tmp = t_0; elseif (z <= 1.4) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 + x) - (z * sin(y)); tmp = 0.0; if (z <= -265.0) tmp = t_0; elseif (z <= 1.4) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -265.0], t$95$0, If[LessEqual[z, 1.4], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + x\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -265:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.4:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -265 or 1.3999999999999999 < z Initial program 99.8%
Taylor expanded in y around 0
Applied rewrites99.2%
if -265 < z < 1.3999999999999999Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6498.4
Applied rewrites98.4%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (- z) (sin y)))) (if (<= z -1.9e+183) t_0 (if (<= z 2e+83) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = -z * sin(y);
double tmp;
if (z <= -1.9e+183) {
tmp = t_0;
} else if (z <= 2e+83) {
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 = -z * sin(y)
if (z <= (-1.9d+183)) then
tmp = t_0
else if (z <= 2d+83) 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 = -z * Math.sin(y);
double tmp;
if (z <= -1.9e+183) {
tmp = t_0;
} else if (z <= 2e+83) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -z * math.sin(y) tmp = 0 if z <= -1.9e+183: tmp = t_0 elif z <= 2e+83: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) * sin(y)) tmp = 0.0 if (z <= -1.9e+183) tmp = t_0; elseif (z <= 2e+83) tmp = Float64(x + cos(y)); 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 <= -1.9e+183) tmp = t_0; elseif (z <= 2e+83) tmp = x + cos(y); 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, -1.9e+183], t$95$0, If[LessEqual[z, 2e+83], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) \cdot \sin y\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+83}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.9e183 or 2.00000000000000006e83 < z Initial program 99.7%
Taylor expanded in z around inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sin.f6470.8
Applied rewrites70.8%
if -1.9e183 < z < 2.00000000000000006e83Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6490.0
Applied rewrites90.0%
Final simplification85.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -0.0026)
t_0
(if (<= y 1100000000000.0)
(fma (- (* (* (* z y) 0.16666666666666666) y) z) y (+ 1.0 x))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -0.0026) {
tmp = t_0;
} else if (y <= 1100000000000.0) {
tmp = fma(((((z * y) * 0.16666666666666666) * y) - z), y, (1.0 + x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -0.0026) tmp = t_0; elseif (y <= 1100000000000.0) tmp = fma(Float64(Float64(Float64(Float64(z * y) * 0.16666666666666666) * y) - z), y, Float64(1.0 + x)); 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, -0.0026], t$95$0, If[LessEqual[y, 1100000000000.0], N[(N[(N[(N[(N[(z * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + N[(1.0 + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -0.0026:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1100000000000:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(z \cdot y\right) \cdot 0.16666666666666666\right) \cdot y - z, y, 1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.0025999999999999999 or 1.1e12 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6464.7
Applied rewrites64.7%
if -0.0025999999999999999 < y < 1.1e12Initial 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-+.f6497.4
Applied rewrites97.4%
Taylor expanded in z around inf
Applied rewrites97.4%
Final simplification81.9%
(FPCore (x y z)
:precision binary64
(if (<= y -5.1)
(+ 1.0 x)
(if (<= y 1.45e+18)
(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 <= -5.1) {
tmp = 1.0 + x;
} else if (y <= 1.45e+18) {
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 <= -5.1) tmp = Float64(1.0 + x); elseif (y <= 1.45e+18) 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, -5.1], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 1.45e+18], 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 -5.1:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+18}:\\
\;\;\;\;\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 < -5.0999999999999996 or 1.45e18 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6436.4
Applied rewrites36.4%
if -5.0999999999999996 < y < 1.45e18Initial 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-+.f6497.3
Applied rewrites97.3%
(FPCore (x y z) :precision binary64 (if (<= y -46000000000.0) (+ 1.0 x) (if (<= y 1.16e+44) (fma (- (* -0.5 y) z) y (+ 1.0 x)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -46000000000.0) {
tmp = 1.0 + x;
} else if (y <= 1.16e+44) {
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 <= -46000000000.0) tmp = Float64(1.0 + x); elseif (y <= 1.16e+44) 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, -46000000000.0], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 1.16e+44], 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 -46000000000:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - z, y, 1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -4.6e10 or 1.1600000000000001e44 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6435.9
Applied rewrites35.9%
if -4.6e10 < y < 1.1600000000000001e44Initial 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.6
Applied rewrites94.6%
(FPCore (x y z) :precision binary64 (if (<= y -5.8e+52) (+ 1.0 x) (if (<= y 8.4e+43) (- x (fma z y -1.0)) (+ 1.0 x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.8e+52) {
tmp = 1.0 + x;
} else if (y <= 8.4e+43) {
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.8e+52) tmp = Float64(1.0 + x); elseif (y <= 8.4e+43) 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.8e+52], N[(1.0 + x), $MachinePrecision], If[LessEqual[y, 8.4e+43], 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.8 \cdot 10^{+52}:\\
\;\;\;\;1 + x\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+43}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y, -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x\\
\end{array}
\end{array}
if y < -5.8e52 or 8.40000000000000007e43 < y Initial program 99.8%
Taylor expanded in y around 0
lower-+.f6435.8
Applied rewrites35.8%
if -5.8e52 < y < 8.40000000000000007e43Initial 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.f6490.6
Applied rewrites90.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-+.f6462.6
Applied rewrites62.6%
(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-+.f6462.6
Applied rewrites62.6%
Taylor expanded in x around 0
Applied rewrites21.0%
herbie shell --seed 2024255
(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))))