
(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 (- (+ 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)))
(t_1 (* z (sin y)))
(t_2 (- t_0 t_1))
(t_3 (- x t_1)))
(if (<= t_2 -20000000.0) t_3 (if (<= t_2 50000000.0) t_0 t_3))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = z * sin(y);
double t_2 = t_0 - t_1;
double t_3 = x - t_1;
double tmp;
if (t_2 <= -20000000.0) {
tmp = t_3;
} else if (t_2 <= 50000000.0) {
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 = z * sin(y)
t_2 = t_0 - t_1
t_3 = x - t_1
if (t_2 <= (-20000000.0d0)) then
tmp = t_3
else if (t_2 <= 50000000.0d0) 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 = z * Math.sin(y);
double t_2 = t_0 - t_1;
double t_3 = x - t_1;
double tmp;
if (t_2 <= -20000000.0) {
tmp = t_3;
} else if (t_2 <= 50000000.0) {
tmp = t_0;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) t_1 = z * math.sin(y) t_2 = t_0 - t_1 t_3 = x - t_1 tmp = 0 if t_2 <= -20000000.0: tmp = t_3 elif t_2 <= 50000000.0: tmp = t_0 else: tmp = t_3 return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(z * sin(y)) t_2 = Float64(t_0 - t_1) t_3 = Float64(x - t_1) tmp = 0.0 if (t_2 <= -20000000.0) tmp = t_3; elseif (t_2 <= 50000000.0) 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 = z * sin(y); t_2 = t_0 - t_1; t_3 = x - t_1; tmp = 0.0; if (t_2 <= -20000000.0) tmp = t_3; elseif (t_2 <= 50000000.0) 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[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -20000000.0], t$95$3, If[LessEqual[t$95$2, 50000000.0], t$95$0, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
t_3 := x - t\_1\\
\mathbf{if}\;t\_2 \leq -20000000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 50000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -2e7 or 5e7 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in x around inf
Simplified99.5%
if -2e7 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 5e7Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f64100.0
Simplified100.0%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (* z (sin y))))) (if (<= z -7.2e+204) t_0 (if (<= z 1.35e+126) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = -(z * sin(y));
double tmp;
if (z <= -7.2e+204) {
tmp = t_0;
} else if (z <= 1.35e+126) {
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 <= (-7.2d+204)) then
tmp = t_0
else if (z <= 1.35d+126) 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 <= -7.2e+204) {
tmp = t_0;
} else if (z <= 1.35e+126) {
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 <= -7.2e+204: tmp = t_0 elif z <= 1.35e+126: 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 <= -7.2e+204) tmp = t_0; elseif (z <= 1.35e+126) 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 <= -7.2e+204) tmp = t_0; elseif (z <= 1.35e+126) 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, -7.2e+204], t$95$0, If[LessEqual[z, 1.35e+126], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -z \cdot \sin y\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+126}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.2000000000000005e204 or 1.35000000000000001e126 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6472.5
Simplified72.5%
if -7.2000000000000005e204 < z < 1.35000000000000001e126Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6489.5
Simplified89.5%
Final simplification85.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -76000.0)
t_0
(if (<= y 0.116)
(+ 1.0 (fma y (fma y (* (* y z) 0.16666666666666666) (- z)) x))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -76000.0) {
tmp = t_0;
} else if (y <= 0.116) {
tmp = 1.0 + fma(y, fma(y, ((y * z) * 0.16666666666666666), -z), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -76000.0) tmp = t_0; elseif (y <= 0.116) tmp = Float64(1.0 + fma(y, fma(y, Float64(Float64(y * z) * 0.16666666666666666), Float64(-z)), 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, -76000.0], t$95$0, If[LessEqual[y, 0.116], N[(1.0 + N[(y * N[(y * N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + (-z)), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -76000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.116:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \left(y \cdot z\right) \cdot 0.16666666666666666, -z\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -76000 or 0.116000000000000006 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6464.3
Simplified64.3%
if -76000 < y < 0.116000000000000006Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6499.0
Simplified99.0%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6499.0
Simplified99.0%
Final simplification82.4%
(FPCore (x y z)
:precision binary64
(if (<= y -2.1e+16)
(+ x 1.0)
(if (<= y 6e+27)
(+ 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.1e+16) {
tmp = x + 1.0;
} else if (y <= 6e+27) {
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.1e+16) tmp = Float64(x + 1.0); elseif (y <= 6e+27) 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.1e+16], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 6e+27], 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.1 \cdot 10^{+16}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+27}:\\
\;\;\;\;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.1e16 or 5.99999999999999953e27 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6449.7
Simplified49.7%
if -2.1e16 < y < 5.99999999999999953e27Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6496.0
Simplified96.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.1e+43) (+ x 1.0) (if (<= y 1.18e+52) (fma y (- (* y -0.5) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+43) {
tmp = x + 1.0;
} else if (y <= 1.18e+52) {
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 <= -1.1e+43) tmp = Float64(x + 1.0); elseif (y <= 1.18e+52) 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, -1.1e+43], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.18e+52], 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 -1.1 \cdot 10^{+43}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.1e43 or 1.17999999999999997e52 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6449.6
Simplified49.6%
if -1.1e43 < y < 1.17999999999999997e52Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6494.1
Simplified94.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.05e+83) (+ x 1.0) (if (<= y 1.2e+52) (- (- x (* y z)) -1.0) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+83) {
tmp = x + 1.0;
} else if (y <= 1.2e+52) {
tmp = (x - (y * z)) - -1.0;
} else {
tmp = x + 1.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) :: tmp
if (y <= (-1.05d+83)) then
tmp = x + 1.0d0
else if (y <= 1.2d+52) then
tmp = (x - (y * z)) - (-1.0d0)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+83) {
tmp = x + 1.0;
} else if (y <= 1.2e+52) {
tmp = (x - (y * z)) - -1.0;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.05e+83: tmp = x + 1.0 elif y <= 1.2e+52: tmp = (x - (y * z)) - -1.0 else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.05e+83) tmp = Float64(x + 1.0); elseif (y <= 1.2e+52) tmp = Float64(Float64(x - Float64(y * z)) - -1.0); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.05e+83) tmp = x + 1.0; elseif (y <= 1.2e+52) tmp = (x - (y * z)) - -1.0; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.05e+83], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.2e+52], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+83}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+52}:\\
\;\;\;\;\left(x - y \cdot z\right) - -1\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.05000000000000001e83 or 1.2e52 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6448.5
Simplified48.5%
if -1.05000000000000001e83 < y < 1.2e52Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6492.1
Simplified92.1%
associate--r+N/A
--lowering--.f64N/A
--lowering--.f64N/A
*-lowering-*.f6492.1
Applied egg-rr92.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.65e+83) (+ x 1.0) (if (<= y 1.2e+52) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+83) {
tmp = x + 1.0;
} else if (y <= 1.2e+52) {
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.65e+83) tmp = Float64(x + 1.0); elseif (y <= 1.2e+52) 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.65e+83], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.2e+52], 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.65 \cdot 10^{+83}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+52}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.64999999999999992e83 or 1.2e52 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6448.5
Simplified48.5%
if -1.64999999999999992e83 < y < 1.2e52Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6492.1
Simplified92.1%
(FPCore (x y z) :precision binary64 (if (<= x -3.9e-14) (+ x 1.0) (if (<= x 0.41) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.9e-14) {
tmp = x + 1.0;
} else if (x <= 0.41) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-3.9d-14)) then
tmp = x + 1.0d0
else if (x <= 0.41d0) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.9e-14) {
tmp = x + 1.0;
} else if (x <= 0.41) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.9e-14: tmp = x + 1.0 elif x <= 0.41: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.9e-14) tmp = Float64(x + 1.0); elseif (x <= 0.41) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.9e-14) tmp = x + 1.0; elseif (x <= 0.41) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.9e-14], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 0.41], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-14}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 0.41:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -3.8999999999999998e-14 or 0.409999999999999976 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6482.0
Simplified82.0%
if -3.8999999999999998e-14 < x < 0.409999999999999976Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6464.1
Simplified64.1%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f6464.1
Simplified64.1%
(FPCore (x y z) :precision binary64 (if (<= z 1.65e+197) (+ x 1.0) (- (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.65e+197) {
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.65d+197) 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.65e+197) {
tmp = x + 1.0;
} else {
tmp = -(y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.65e+197: tmp = x + 1.0 else: tmp = -(y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.65e+197) tmp = Float64(x + 1.0); else tmp = Float64(-Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.65e+197) tmp = x + 1.0; else tmp = -(y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.65e+197], N[(x + 1.0), $MachinePrecision], (-N[(y * z), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.65 \cdot 10^{+197}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;-y \cdot z\\
\end{array}
\end{array}
if z < 1.6499999999999998e197Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6473.3
Simplified73.3%
if 1.6499999999999998e197 < z Initial program 99.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6450.7
Simplified50.7%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6435.2
Simplified35.2%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (if (<= x -3600.0) x (if (<= x 0.00052) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3600.0) {
tmp = x;
} else if (x <= 0.00052) {
tmp = 1.0;
} else {
tmp = 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 (x <= (-3600.0d0)) then
tmp = x
else if (x <= 0.00052d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3600.0) {
tmp = x;
} else if (x <= 0.00052) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3600.0: tmp = x elif x <= 0.00052: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3600.0) tmp = x; elseif (x <= 0.00052) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3600.0) tmp = x; elseif (x <= 0.00052) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3600.0], x, If[LessEqual[x, 0.00052], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3600:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.00052:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3600 or 5.19999999999999954e-4 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified83.7%
if -3600 < x < 5.19999999999999954e-4Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6461.8
Simplified61.8%
Taylor expanded in y around 0
Simplified49.8%
Taylor expanded in x around 0
Simplified49.3%
(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
+-lowering-+.f6467.1
Simplified67.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
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6467.5
Simplified67.5%
Taylor expanded in y around 0
Simplified67.1%
Taylor expanded in x around 0
Simplified26.0%
herbie shell --seed 2024199
(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))))