
(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 14 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 (* z (sin y))) (t_1 (- x t_0))) (if (<= x -0.98) t_1 (if (<= x 0.84) (- (cos y) t_0) t_1))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = x - t_0;
double tmp;
if (x <= -0.98) {
tmp = t_1;
} else if (x <= 0.84) {
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 = z * sin(y)
t_1 = x - t_0
if (x <= (-0.98d0)) then
tmp = t_1
else if (x <= 0.84d0) 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 = z * Math.sin(y);
double t_1 = x - t_0;
double tmp;
if (x <= -0.98) {
tmp = t_1;
} else if (x <= 0.84) {
tmp = Math.cos(y) - t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = x - t_0 tmp = 0 if x <= -0.98: tmp = t_1 elif x <= 0.84: tmp = math.cos(y) - t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(x - t_0) tmp = 0.0 if (x <= -0.98) tmp = t_1; elseif (x <= 0.84) tmp = Float64(cos(y) - t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = x - t_0; tmp = 0.0; if (x <= -0.98) tmp = t_1; elseif (x <= 0.84) tmp = cos(y) - t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - t$95$0), $MachinePrecision]}, If[LessEqual[x, -0.98], t$95$1, If[LessEqual[x, 0.84], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := x - t\_0\\
\mathbf{if}\;x \leq -0.98:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.84:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -0.97999999999999998 or 0.839999999999999969 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified98.8%
if -0.97999999999999998 < x < 0.839999999999999969Initial program 99.8%
Taylor expanded in x around 0
cos-lowering-cos.f6499.0%
Simplified99.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- x (* z (sin y))))) (if (<= z -4.5e+25) t_0 (if (<= z 2.05e+36) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = x - (z * sin(y));
double tmp;
if (z <= -4.5e+25) {
tmp = t_0;
} else if (z <= 2.05e+36) {
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 - (z * sin(y))
if (z <= (-4.5d+25)) then
tmp = t_0
else if (z <= 2.05d+36) 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 - (z * Math.sin(y));
double tmp;
if (z <= -4.5e+25) {
tmp = t_0;
} else if (z <= 2.05e+36) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x - (z * math.sin(y)) tmp = 0 if z <= -4.5e+25: tmp = t_0 elif z <= 2.05e+36: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x - Float64(z * sin(y))) tmp = 0.0 if (z <= -4.5e+25) tmp = t_0; elseif (z <= 2.05e+36) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (z * sin(y)); tmp = 0.0; if (z <= -4.5e+25) tmp = t_0; elseif (z <= 2.05e+36) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+25], t$95$0, If[LessEqual[z, 2.05e+36], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - z \cdot \sin y\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+36}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.5000000000000003e25 or 2.05000000000000006e36 < z Initial program 99.8%
Taylor expanded in x around inf
Simplified90.8%
if -4.5000000000000003e25 < z < 2.05000000000000006e36Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6498.6%
Simplified98.6%
Final simplification95.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (- 0.0 (sin y))))) (if (<= z -1.3e+132) t_0 (if (<= z 1.5e+52) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = z * (0.0 - sin(y));
double tmp;
if (z <= -1.3e+132) {
tmp = t_0;
} else if (z <= 1.5e+52) {
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 * (0.0d0 - sin(y))
if (z <= (-1.3d+132)) then
tmp = t_0
else if (z <= 1.5d+52) 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 * (0.0 - Math.sin(y));
double tmp;
if (z <= -1.3e+132) {
tmp = t_0;
} else if (z <= 1.5e+52) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (0.0 - math.sin(y)) tmp = 0 if z <= -1.3e+132: tmp = t_0 elif z <= 1.5e+52: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(0.0 - sin(y))) tmp = 0.0 if (z <= -1.3e+132) tmp = t_0; elseif (z <= 1.5e+52) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (0.0 - sin(y)); tmp = 0.0; if (z <= -1.3e+132) tmp = t_0; elseif (z <= 1.5e+52) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(0.0 - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+132], t$95$0, If[LessEqual[z, 1.5e+52], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(0 - \sin y\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+52}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.3e132 or 1.5e52 < z Initial program 99.8%
flip--N/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.7%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6466.0%
Simplified66.0%
associate-/r/N/A
metadata-evalN/A
neg-mul-1N/A
*-commutativeN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
sin-lowering-sin.f6466.1%
Applied egg-rr66.1%
if -1.3e132 < z < 1.5e52Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6491.4%
Simplified91.4%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -80000.0)
t_0
(if (<= y 0.75)
(+
1.0
(fma y (- (fma y (fma z (* y 0.16666666666666666) -0.5) 0.0) z) x))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -80000.0) {
tmp = t_0;
} else if (y <= 0.75) {
tmp = 1.0 + fma(y, (fma(y, fma(z, (y * 0.16666666666666666), -0.5), 0.0) - z), x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -80000.0) tmp = t_0; elseif (y <= 0.75) tmp = Float64(1.0 + fma(y, Float64(fma(y, fma(z, Float64(y * 0.16666666666666666), -0.5), 0.0) - 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, -80000.0], t$95$0, If[LessEqual[y, 0.75], N[(1.0 + N[(y * N[(N[(y * N[(z * N[(y * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision] + 0.0), $MachinePrecision] - z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -80000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(z, y \cdot 0.16666666666666666, -0.5\right), 0\right) - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8e4 or 0.75 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6462.1%
Simplified62.1%
if -8e4 < y < 0.75Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6499.3%
Simplified99.3%
Final simplification80.8%
(FPCore (x y z) :precision binary64 (if (<= x -9.5e-11) (+ x 1.0) (if (<= x 5.4e-22) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -9.5e-11) {
tmp = x + 1.0;
} else if (x <= 5.4e-22) {
tmp = cos(y);
} 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 <= (-9.5d-11)) then
tmp = x + 1.0d0
else if (x <= 5.4d-22) then
tmp = cos(y)
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 <= -9.5e-11) {
tmp = x + 1.0;
} else if (x <= 5.4e-22) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9.5e-11: tmp = x + 1.0 elif x <= 5.4e-22: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9.5e-11) tmp = Float64(x + 1.0); elseif (x <= 5.4e-22) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -9.5e-11) tmp = x + 1.0; elseif (x <= 5.4e-22) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9.5e-11], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 5.4e-22], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-11}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-22}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -9.49999999999999951e-11 or 5.4000000000000004e-22 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6481.9%
Simplified81.9%
if -9.49999999999999951e-11 < x < 5.4000000000000004e-22Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6460.7%
Simplified60.7%
Taylor expanded in x around 0
cos-lowering-cos.f6460.7%
Simplified60.7%
(FPCore (x y z)
:precision binary64
(if (<= y -85000000.0)
(+ x 1.0)
(if (<= y 98000.0)
(+ 1.0 (fma y (- (fma y (fma z (* y 0.16666666666666666) -0.5) 0.0) z) x))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -85000000.0) {
tmp = x + 1.0;
} else if (y <= 98000.0) {
tmp = 1.0 + fma(y, (fma(y, fma(z, (y * 0.16666666666666666), -0.5), 0.0) - z), x);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -85000000.0) tmp = Float64(x + 1.0); elseif (y <= 98000.0) tmp = Float64(1.0 + fma(y, Float64(fma(y, fma(z, Float64(y * 0.16666666666666666), -0.5), 0.0) - z), x)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -85000000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 98000.0], N[(1.0 + N[(y * N[(N[(y * N[(z * N[(y * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision] + 0.0), $MachinePrecision] - z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -85000000:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 98000:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(z, y \cdot 0.16666666666666666, -0.5\right), 0\right) - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -8.5e7 or 98000 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6440.0%
Simplified40.0%
if -8.5e7 < y < 98000Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6499.3%
Simplified99.3%
(FPCore (x y z) :precision binary64 (if (<= y -60000.0) (+ x 1.0) (if (<= y 30000.0) (fma y (- (fma y -0.5 0.0) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -60000.0) {
tmp = x + 1.0;
} else if (y <= 30000.0) {
tmp = fma(y, (fma(y, -0.5, 0.0) - z), (x + 1.0));
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -60000.0) tmp = Float64(x + 1.0); elseif (y <= 30000.0) tmp = fma(y, Float64(fma(y, -0.5, 0.0) - z), Float64(x + 1.0)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -60000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 30000.0], N[(y * N[(N[(y * -0.5 + 0.0), $MachinePrecision] - z), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -60000:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 30000:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.5, 0\right) - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -6e4 or 3e4 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6439.7%
Simplified39.7%
if -6e4 < y < 3e4Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
+-lowering-+.f6499.8%
Simplified99.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.65e+34) (+ x 1.0) (if (<= y 1.7e+19) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+34) {
tmp = x + 1.0;
} else if (y <= 1.7e+19) {
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+34) tmp = Float64(x + 1.0); elseif (y <= 1.7e+19) 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+34], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.7e+19], 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^{+34}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+19}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.64999999999999994e34 or 1.7e19 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6442.2%
Simplified42.2%
if -1.64999999999999994e34 < y < 1.7e19Initial 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.f6491.5%
Simplified91.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- x (* y z)))) (if (<= z -6.1e+206) t_0 (if (<= z 1.95e+276) (+ x 1.0) t_0))))
double code(double x, double y, double z) {
double t_0 = x - (y * z);
double tmp;
if (z <= -6.1e+206) {
tmp = t_0;
} else if (z <= 1.95e+276) {
tmp = x + 1.0;
} 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 - (y * z)
if (z <= (-6.1d+206)) then
tmp = t_0
else if (z <= 1.95d+276) then
tmp = x + 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (y * z);
double tmp;
if (z <= -6.1e+206) {
tmp = t_0;
} else if (z <= 1.95e+276) {
tmp = x + 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x - (y * z) tmp = 0 if z <= -6.1e+206: tmp = t_0 elif z <= 1.95e+276: tmp = x + 1.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x - Float64(y * z)) tmp = 0.0 if (z <= -6.1e+206) tmp = t_0; elseif (z <= 1.95e+276) tmp = Float64(x + 1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (y * z); tmp = 0.0; if (z <= -6.1e+206) tmp = t_0; elseif (z <= 1.95e+276) tmp = x + 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.1e+206], t$95$0, If[LessEqual[z, 1.95e+276], N[(x + 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - y \cdot z\\
\mathbf{if}\;z \leq -6.1 \cdot 10^{+206}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+276}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.09999999999999967e206 or 1.9500000000000001e276 < z Initial program 99.9%
Taylor expanded in x around inf
Simplified98.6%
Taylor expanded in y around 0
Simplified63.9%
if -6.09999999999999967e206 < z < 1.9500000000000001e276Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6466.0%
Simplified66.0%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (<= z -7.2e+208) (- 0.0 (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.2e+208) {
tmp = 0.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 (z <= (-7.2d+208)) then
tmp = 0.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 (z <= -7.2e+208) {
tmp = 0.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.2e+208: tmp = 0.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.2e+208) tmp = Float64(0.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 (z <= -7.2e+208) tmp = 0.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.2e+208], N[(0.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+208}:\\
\;\;\;\;0 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -7.20000000000000005e208Initial program 100.0%
flip--N/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.8%
Taylor expanded in z around inf
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6482.9%
Simplified82.9%
associate-/r/N/A
metadata-evalN/A
neg-mul-1N/A
*-commutativeN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
sin-lowering-sin.f6483.0%
Applied egg-rr83.0%
Taylor expanded in y around 0
Simplified48.1%
if -7.20000000000000005e208 < z Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6464.3%
Simplified64.3%
Final simplification63.1%
(FPCore (x y z) :precision binary64 (if (<= x -7e-17) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7e-17) {
tmp = x;
} else if (x <= 1.0) {
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 <= (-7d-17)) then
tmp = x
else if (x <= 1.0d0) 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 <= -7e-17) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7e-17: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7e-17) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7e-17) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7e-17], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.0000000000000003e-17 or 1 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified80.6%
if -7.0000000000000003e-17 < x < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6440.2%
Simplified40.2%
Taylor expanded in x around 0
Simplified39.4%
(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-+.f6460.9%
Simplified60.9%
(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
+-lowering-+.f6460.9%
Simplified60.9%
Taylor expanded in x around 0
Simplified20.9%
herbie shell --seed 2024193
(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))))