
(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)) (* z (sin y)))))
(if (<= t_0 -1000000.0)
(- x (fma y z -1.0))
(if (<= t_0 0.9995) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double t_0 = (x + cos(y)) - (z * sin(y));
double tmp;
if (t_0 <= -1000000.0) {
tmp = x - fma(y, z, -1.0);
} else if (t_0 <= 0.9995) {
tmp = cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + cos(y)) - Float64(z * sin(y))) tmp = 0.0 if (t_0 <= -1000000.0) tmp = Float64(x - fma(y, z, -1.0)); elseif (t_0 <= 0.9995) tmp = cos(y); else tmp = Float64(x + 1.0); 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]}, If[LessEqual[t$95$0, -1000000.0], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.9995], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \cos y\right) - z \cdot \sin y\\
\mathbf{if}\;t\_0 \leq -1000000:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{elif}\;t\_0 \leq 0.9995:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e6Initial 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.f6469.4
Applied rewrites69.4%
if -1e6 < (-.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.f6496.9
Applied rewrites96.9%
Taylor expanded in x around 0
Applied rewrites95.6%
if 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
lower-+.f6475.8
Applied rewrites75.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ x 1.0) (* z (sin y))))) (if (<= z -3e+15) t_0 (if (<= z 0.95) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (x + 1.0) - (z * sin(y));
double tmp;
if (z <= -3e+15) {
tmp = t_0;
} else if (z <= 0.95) {
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 = (x + 1.0d0) - (z * sin(y))
if (z <= (-3d+15)) then
tmp = t_0
else if (z <= 0.95d0) 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 = (x + 1.0) - (z * Math.sin(y));
double tmp;
if (z <= -3e+15) {
tmp = t_0;
} else if (z <= 0.95) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + 1.0) - (z * math.sin(y)) tmp = 0 if z <= -3e+15: tmp = t_0 elif z <= 0.95: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 1.0) - Float64(z * sin(y))) tmp = 0.0 if (z <= -3e+15) tmp = t_0; elseif (z <= 0.95) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 1.0) - (z * sin(y)); tmp = 0.0; if (z <= -3e+15) tmp = t_0; elseif (z <= 0.95) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e+15], t$95$0, If[LessEqual[z, 0.95], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + 1\right) - z \cdot \sin y\\
\mathbf{if}\;z \leq -3 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.95:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3e15 or 0.94999999999999996 < z Initial program 99.9%
Taylor expanded in y around 0
Applied rewrites99.9%
if -3e15 < z < 0.94999999999999996Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6499.3
Applied rewrites99.3%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (sin y) (- z)))) (if (<= z -3.5e+118) t_0 (if (<= z 1.6e+111) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -3.5e+118) {
tmp = t_0;
} else if (z <= 1.6e+111) {
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 <= (-3.5d+118)) then
tmp = t_0
else if (z <= 1.6d+111) 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 <= -3.5e+118) {
tmp = t_0;
} else if (z <= 1.6e+111) {
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 <= -3.5e+118: tmp = t_0 elif z <= 1.6e+111: 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 <= -3.5e+118) tmp = t_0; elseif (z <= 1.6e+111) 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 <= -3.5e+118) tmp = t_0; elseif (z <= 1.6e+111) 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, -3.5e+118], t$95$0, If[LessEqual[z, 1.6e+111], 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 -3.5 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+111}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.50000000000000016e118 or 1.6e111 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-sin.f6469.1
Applied rewrites69.1%
if -3.50000000000000016e118 < z < 1.6e111Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6492.5
Applied rewrites92.5%
Final simplification85.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -23000.0)
t_0
(if (<= y 3.9e-15)
(- (+ x 1.0) (* y (fma y (* z (* y -0.16666666666666666)) z)))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -23000.0) {
tmp = t_0;
} else if (y <= 3.9e-15) {
tmp = (x + 1.0) - (y * fma(y, (z * (y * -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 <= -23000.0) tmp = t_0; elseif (y <= 3.9e-15) tmp = Float64(Float64(x + 1.0) - Float64(y * fma(y, Float64(z * Float64(y * -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, -23000.0], t$95$0, If[LessEqual[y, 3.9e-15], N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(y * N[(z * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -23000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-15}:\\
\;\;\;\;\left(x + 1\right) - y \cdot \mathsf{fma}\left(y, z \cdot \left(y \cdot -0.16666666666666666\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -23000 or 3.90000000000000026e-15 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
lower-cos.f6460.7
Applied rewrites60.7%
if -23000 < y < 3.90000000000000026e-15Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites100.0%
Taylor expanded in y around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification81.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.2e+24) (+ x (/ -1.0 (fma y (- z) -1.0))) (if (<= y 3100000.0) (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.2e+24) {
tmp = x + (-1.0 / fma(y, -z, -1.0));
} else if (y <= 3100000.0) {
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.2e+24) tmp = Float64(x + Float64(-1.0 / fma(y, Float64(-z), -1.0))); elseif (y <= 3100000.0) 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.2e+24], N[(x + N[(-1.0 / N[(y * (-z) + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3100000.0], 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.2 \cdot 10^{+24}:\\
\;\;\;\;x + \frac{-1}{\mathsf{fma}\left(y, -z, -1\right)}\\
\mathbf{elif}\;y \leq 3100000:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.20000000000000002e24Initial program 99.8%
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.f6431.7
Applied rewrites31.7%
Applied rewrites29.5%
Taylor expanded in y around 0
Applied rewrites40.0%
if -2.20000000000000002e24 < y < 3.1e6Initial 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-+.f6496.3
Applied rewrites96.3%
if 3.1e6 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6438.4
Applied rewrites38.4%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (<= y -2.2e+24) (+ x 1.0) (if (<= y 3100000.0) (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.2e+24) {
tmp = x + 1.0;
} else if (y <= 3100000.0) {
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.2e+24) tmp = Float64(x + 1.0); elseif (y <= 3100000.0) 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.2e+24], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 3100000.0], 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.2 \cdot 10^{+24}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 3100000:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.20000000000000002e24 or 3.1e6 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6439.2
Applied rewrites39.2%
if -2.20000000000000002e24 < y < 3.1e6Initial 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-+.f6496.3
Applied rewrites96.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.24e+42) (+ x 1.0) (if (<= y 1750000.0) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.24e+42) {
tmp = x + 1.0;
} else if (y <= 1750000.0) {
tmp = x - fma(y, z, -1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -1.24e+42) tmp = Float64(x + 1.0); elseif (y <= 1750000.0) 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, -1.24e+42], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1750000.0], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.24 \cdot 10^{+42}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1750000:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.24e42 or 1.75e6 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6438.3
Applied rewrites38.3%
if -1.24e42 < y < 1.75e6Initial 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.4
Applied rewrites95.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.3e-19) (- x (* y z)) (if (<= x 4.2e-9) (fma y (- z) 1.0) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-19) {
tmp = x - (y * z);
} else if (x <= 4.2e-9) {
tmp = fma(y, -z, 1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -1.3e-19) tmp = Float64(x - Float64(y * z)); elseif (x <= 4.2e-9) tmp = fma(y, Float64(-z), 1.0); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -1.3e-19], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e-9], N[(y * (-z) + 1.0), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-19}:\\
\;\;\;\;x - y \cdot z\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.30000000000000006e-19Initial 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.f6484.4
Applied rewrites84.4%
Taylor expanded in y around inf
Applied rewrites83.7%
if -1.30000000000000006e-19 < x < 4.20000000000000039e-9Initial program 99.8%
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.f6451.7
Applied rewrites51.7%
Taylor expanded in x around 0
Applied rewrites51.7%
if 4.20000000000000039e-9 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6483.3
Applied rewrites83.3%
(FPCore (x y z) :precision binary64 (if (<= x -0.0003) (+ x 1.0) (if (<= x 4.2e-9) (fma y (- z) 1.0) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.0003) {
tmp = x + 1.0;
} else if (x <= 4.2e-9) {
tmp = fma(y, -z, 1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -0.0003) tmp = Float64(x + 1.0); elseif (x <= 4.2e-9) tmp = fma(y, Float64(-z), 1.0); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -0.0003], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 4.2e-9], N[(y * (-z) + 1.0), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0003:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -2.99999999999999974e-4 or 4.20000000000000039e-9 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-+.f6485.6
Applied rewrites85.6%
if -2.99999999999999974e-4 < x < 4.20000000000000039e-9Initial program 99.8%
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.f6450.6
Applied rewrites50.6%
Taylor expanded in x around 0
Applied rewrites50.6%
(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-+.f6463.3
Applied rewrites63.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-+.f6463.3
Applied rewrites63.3%
Taylor expanded in x around 0
Applied rewrites21.0%
herbie shell --seed 2024222
(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))))