
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + 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 = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* z (cos y)) (+ x (sin y)))))
(if (<= t_0 -50000000.0)
(+ x z)
(if (<= t_0 -0.1)
(sin y)
(if (<= t_0 1e-18) (+ y (+ x z)) (if (<= t_0 1.0) (sin y) (+ x z)))))))
double code(double x, double y, double z) {
double t_0 = (z * cos(y)) + (x + sin(y));
double tmp;
if (t_0 <= -50000000.0) {
tmp = x + z;
} else if (t_0 <= -0.1) {
tmp = sin(y);
} else if (t_0 <= 1e-18) {
tmp = y + (x + z);
} else if (t_0 <= 1.0) {
tmp = sin(y);
} else {
tmp = x + 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) :: t_0
real(8) :: tmp
t_0 = (z * cos(y)) + (x + sin(y))
if (t_0 <= (-50000000.0d0)) then
tmp = x + z
else if (t_0 <= (-0.1d0)) then
tmp = sin(y)
else if (t_0 <= 1d-18) then
tmp = y + (x + z)
else if (t_0 <= 1.0d0) then
tmp = sin(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * Math.cos(y)) + (x + Math.sin(y));
double tmp;
if (t_0 <= -50000000.0) {
tmp = x + z;
} else if (t_0 <= -0.1) {
tmp = Math.sin(y);
} else if (t_0 <= 1e-18) {
tmp = y + (x + z);
} else if (t_0 <= 1.0) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): t_0 = (z * math.cos(y)) + (x + math.sin(y)) tmp = 0 if t_0 <= -50000000.0: tmp = x + z elif t_0 <= -0.1: tmp = math.sin(y) elif t_0 <= 1e-18: tmp = y + (x + z) elif t_0 <= 1.0: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) t_0 = Float64(Float64(z * cos(y)) + Float64(x + sin(y))) tmp = 0.0 if (t_0 <= -50000000.0) tmp = Float64(x + z); elseif (t_0 <= -0.1) tmp = sin(y); elseif (t_0 <= 1e-18) tmp = Float64(y + Float64(x + z)); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * cos(y)) + (x + sin(y)); tmp = 0.0; if (t_0 <= -50000000.0) tmp = x + z; elseif (t_0 <= -0.1) tmp = sin(y); elseif (t_0 <= 1e-18) tmp = y + (x + z); elseif (t_0 <= 1.0) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50000000.0], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, -0.1], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 1e-18], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y + \left(x + \sin y\right)\\
\mathbf{if}\;t\_0 \leq -50000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;t\_0 \leq -0.1:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;t\_0 \leq 10^{-18}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -5e7 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6479.0
Simplified79.0%
if -5e7 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.10000000000000001 or 1.0000000000000001e-18 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6497.1
Simplified97.1%
Taylor expanded in z around 0
sin-lowering-sin.f6492.5
Simplified92.5%
if -0.10000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1.0000000000000001e-18Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0
Simplified100.0%
Final simplification84.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y)))
(t_1 (+ x (sin y)))
(t_2 (+ t_0 t_1))
(t_3 (+ x t_0)))
(if (<= t_2 -100000.0) t_3 (if (<= t_2 1.0) (+ z t_1) t_3))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double t_1 = x + sin(y);
double t_2 = t_0 + t_1;
double t_3 = x + t_0;
double tmp;
if (t_2 <= -100000.0) {
tmp = t_3;
} else if (t_2 <= 1.0) {
tmp = z + t_1;
} 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 = z * cos(y)
t_1 = x + sin(y)
t_2 = t_0 + t_1
t_3 = x + t_0
if (t_2 <= (-100000.0d0)) then
tmp = t_3
else if (t_2 <= 1.0d0) then
tmp = z + t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double t_1 = x + Math.sin(y);
double t_2 = t_0 + t_1;
double t_3 = x + t_0;
double tmp;
if (t_2 <= -100000.0) {
tmp = t_3;
} else if (t_2 <= 1.0) {
tmp = z + t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) t_1 = x + math.sin(y) t_2 = t_0 + t_1 t_3 = x + t_0 tmp = 0 if t_2 <= -100000.0: tmp = t_3 elif t_2 <= 1.0: tmp = z + t_1 else: tmp = t_3 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) t_1 = Float64(x + sin(y)) t_2 = Float64(t_0 + t_1) t_3 = Float64(x + t_0) tmp = 0.0 if (t_2 <= -100000.0) tmp = t_3; elseif (t_2 <= 1.0) tmp = Float64(z + t_1); else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); t_1 = x + sin(y); t_2 = t_0 + t_1; t_3 = x + t_0; tmp = 0.0; if (t_2 <= -100000.0) tmp = t_3; elseif (t_2 <= 1.0) tmp = z + t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + 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$0), $MachinePrecision]}, If[LessEqual[t$95$2, -100000.0], t$95$3, If[LessEqual[t$95$2, 1.0], N[(z + t$95$1), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
t_1 := x + \sin y\\
t_2 := t\_0 + t\_1\\
t_3 := x + t\_0\\
\mathbf{if}\;t\_2 \leq -100000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 1:\\
\;\;\;\;z + t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -1e5 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in x around inf
Simplified99.4%
if -1e5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1Initial program 100.0%
Taylor expanded in y around 0
Simplified98.8%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -3.5e+76)
t_0
(if (<= z 460000.0) (+ x (sin y)) (if (<= z 4.9e+179) (+ x z) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -3.5e+76) {
tmp = t_0;
} else if (z <= 460000.0) {
tmp = x + sin(y);
} else if (z <= 4.9e+179) {
tmp = x + z;
} 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 * cos(y)
if (z <= (-3.5d+76)) then
tmp = t_0
else if (z <= 460000.0d0) then
tmp = x + sin(y)
else if (z <= 4.9d+179) then
tmp = x + z
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.cos(y);
double tmp;
if (z <= -3.5e+76) {
tmp = t_0;
} else if (z <= 460000.0) {
tmp = x + Math.sin(y);
} else if (z <= 4.9e+179) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -3.5e+76: tmp = t_0 elif z <= 460000.0: tmp = x + math.sin(y) elif z <= 4.9e+179: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -3.5e+76) tmp = t_0; elseif (z <= 460000.0) tmp = Float64(x + sin(y)); elseif (z <= 4.9e+179) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -3.5e+76) tmp = t_0; elseif (z <= 460000.0) tmp = x + sin(y); elseif (z <= 4.9e+179) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+76], t$95$0, If[LessEqual[z, 460000.0], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+179], N[(x + z), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 460000:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+179}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.5e76 or 4.8999999999999999e179 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6493.5
Simplified93.5%
if -3.5e76 < z < 4.6e5Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6488.7
Simplified88.7%
if 4.6e5 < z < 4.8999999999999999e179Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6488.5
Simplified88.5%
Final simplification89.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (cos y)))) (if (<= z -1.35e+94) t_0 (if (<= z 2.8e+180) (+ z (+ x (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.35e+94) {
tmp = t_0;
} else if (z <= 2.8e+180) {
tmp = z + (x + sin(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 * cos(y)
if (z <= (-1.35d+94)) then
tmp = t_0
else if (z <= 2.8d+180) then
tmp = z + (x + sin(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.cos(y);
double tmp;
if (z <= -1.35e+94) {
tmp = t_0;
} else if (z <= 2.8e+180) {
tmp = z + (x + Math.sin(y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.35e+94: tmp = t_0 elif z <= 2.8e+180: tmp = z + (x + math.sin(y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -1.35e+94) tmp = t_0; elseif (z <= 2.8e+180) tmp = Float64(z + Float64(x + sin(y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -1.35e+94) tmp = t_0; elseif (z <= 2.8e+180) tmp = z + (x + sin(y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+94], t$95$0, If[LessEqual[z, 2.8e+180], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+180}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.3500000000000001e94 or 2.80000000000000012e180 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6493.8
Simplified93.8%
if -1.3500000000000001e94 < z < 2.80000000000000012e180Initial program 100.0%
Taylor expanded in y around 0
Simplified94.9%
Final simplification94.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (sin y)))) (if (<= y -0.009) t_0 (if (<= y 3.4e-21) (+ y (+ x z)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + sin(y);
double tmp;
if (y <= -0.009) {
tmp = t_0;
} else if (y <= 3.4e-21) {
tmp = y + (x + z);
} 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 + sin(y)
if (y <= (-0.009d0)) then
tmp = t_0
else if (y <= 3.4d-21) then
tmp = y + (x + z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.sin(y);
double tmp;
if (y <= -0.009) {
tmp = t_0;
} else if (y <= 3.4e-21) {
tmp = y + (x + z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.sin(y) tmp = 0 if y <= -0.009: tmp = t_0 elif y <= 3.4e-21: tmp = y + (x + z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + sin(y)) tmp = 0.0 if (y <= -0.009) tmp = t_0; elseif (y <= 3.4e-21) tmp = Float64(y + Float64(x + z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + sin(y); tmp = 0.0; if (y <= -0.009) tmp = t_0; elseif (y <= 3.4e-21) tmp = y + (x + z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.009], t$95$0, If[LessEqual[y, 3.4e-21], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -0.009:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-21}:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.00899999999999999932 or 3.4e-21 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6468.7
Simplified68.7%
if -0.00899999999999999932 < y < 3.4e-21Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0
Simplified100.0%
Final simplification83.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.5e+82) z (if (<= z -8.4e-103) x (if (<= z 225000.0) (+ x y) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.5e+82) {
tmp = z;
} else if (z <= -8.4e-103) {
tmp = x;
} else if (z <= 225000.0) {
tmp = x + y;
} else {
tmp = 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.5d+82)) then
tmp = z
else if (z <= (-8.4d-103)) then
tmp = x
else if (z <= 225000.0d0) then
tmp = x + y
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.5e+82) {
tmp = z;
} else if (z <= -8.4e-103) {
tmp = x;
} else if (z <= 225000.0) {
tmp = x + y;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.5e+82: tmp = z elif z <= -8.4e-103: tmp = x elif z <= 225000.0: tmp = x + y else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.5e+82) tmp = z; elseif (z <= -8.4e-103) tmp = x; elseif (z <= 225000.0) tmp = Float64(x + y); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.5e+82) tmp = z; elseif (z <= -8.4e-103) tmp = x; elseif (z <= 225000.0) tmp = x + y; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.5e+82], z, If[LessEqual[z, -8.4e-103], x, If[LessEqual[z, 225000.0], N[(x + y), $MachinePrecision], z]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+82}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq -8.4 \cdot 10^{-103}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 225000:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.49999999999999995e82 or 225000 < z Initial program 99.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6480.9
Simplified80.9%
Taylor expanded in y around 0
Simplified48.5%
if -1.49999999999999995e82 < z < -8.40000000000000019e-103Initial program 99.9%
Taylor expanded in x around inf
Simplified53.3%
if -8.40000000000000019e-103 < z < 225000Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6469.0
Simplified69.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f6464.9
Simplified64.9%
Final simplification56.5%
(FPCore (x y z) :precision binary64 (if (<= x -4.3e-138) (+ x z) (if (<= x 1.1e-140) (+ y z) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.3e-138) {
tmp = x + z;
} else if (x <= 1.1e-140) {
tmp = y + z;
} else {
tmp = x + 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 (x <= (-4.3d-138)) then
tmp = x + z
else if (x <= 1.1d-140) then
tmp = y + z
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.3e-138) {
tmp = x + z;
} else if (x <= 1.1e-140) {
tmp = y + z;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.3e-138: tmp = x + z elif x <= 1.1e-140: tmp = y + z else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.3e-138) tmp = Float64(x + z); elseif (x <= 1.1e-140) tmp = Float64(y + z); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.3e-138) tmp = x + z; elseif (x <= 1.1e-140) tmp = y + z; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.3e-138], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.1e-140], N[(y + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-138}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-140}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -4.3e-138 or 1.1e-140 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6475.8
Simplified75.8%
if -4.3e-138 < x < 1.1e-140Initial program 99.8%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6498.7
Simplified98.7%
Taylor expanded in y around 0
+-lowering-+.f6451.0
Simplified51.0%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (if (<= x -6.6e+35) x (if (<= x 1.9e+32) (+ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e+35) {
tmp = x;
} else if (x <= 1.9e+32) {
tmp = y + z;
} 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 <= (-6.6d+35)) then
tmp = x
else if (x <= 1.9d+32) then
tmp = y + z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e+35) {
tmp = x;
} else if (x <= 1.9e+32) {
tmp = y + z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.6e+35: tmp = x elif x <= 1.9e+32: tmp = y + z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.6e+35) tmp = x; elseif (x <= 1.9e+32) tmp = Float64(y + z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.6e+35) tmp = x; elseif (x <= 1.9e+32) tmp = y + z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.6e+35], x, If[LessEqual[x, 1.9e+32], N[(y + z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{+35}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+32}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.6000000000000003e35 or 1.9000000000000002e32 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified78.3%
if -6.6000000000000003e35 < x < 1.9000000000000002e32Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6489.2
Simplified89.2%
Taylor expanded in y around 0
+-lowering-+.f6444.2
Simplified44.2%
(FPCore (x y z) :precision binary64 (if (<= x -3.15e+35) x (if (<= x 1.65e+32) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.15e+35) {
tmp = x;
} else if (x <= 1.65e+32) {
tmp = z;
} 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 <= (-3.15d+35)) then
tmp = x
else if (x <= 1.65d+32) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.15e+35) {
tmp = x;
} else if (x <= 1.65e+32) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.15e+35: tmp = x elif x <= 1.65e+32: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.15e+35) tmp = x; elseif (x <= 1.65e+32) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.15e+35) tmp = x; elseif (x <= 1.65e+32) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.15e+35], x, If[LessEqual[x, 1.65e+32], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.15 \cdot 10^{+35}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+32}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.14999999999999985e35 or 1.6500000000000001e32 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified78.3%
if -3.14999999999999985e35 < x < 1.6500000000000001e32Initial program 99.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6451.3
Simplified51.3%
Taylor expanded in y around 0
Simplified34.1%
(FPCore (x y z) :precision binary64 (if (<= x -6.6e-137) x (if (<= x 1.3e-143) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e-137) {
tmp = x;
} else if (x <= 1.3e-143) {
tmp = y;
} 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 <= (-6.6d-137)) then
tmp = x
else if (x <= 1.3d-143) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.6e-137) {
tmp = x;
} else if (x <= 1.3e-143) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.6e-137: tmp = x elif x <= 1.3e-143: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.6e-137) tmp = x; elseif (x <= 1.3e-143) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.6e-137) tmp = x; elseif (x <= 1.3e-143) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.6e-137], x, If[LessEqual[x, 1.3e-143], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{-137}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-143}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.6000000000000004e-137 or 1.29999999999999994e-143 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified56.7%
if -6.6000000000000004e-137 < x < 1.29999999999999994e-143Initial program 99.8%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6451.3
Simplified51.3%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6452.2
Simplified52.2%
Taylor expanded in y around inf
Simplified21.8%
(FPCore (x y z) :precision binary64 (if (<= y 310000000000.0) (+ y (+ x z)) (+ x z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 310000000000.0) {
tmp = y + (x + z);
} else {
tmp = x + 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 (y <= 310000000000.0d0) then
tmp = y + (x + z)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 310000000000.0) {
tmp = y + (x + z);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 310000000000.0: tmp = y + (x + z) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 310000000000.0) tmp = Float64(y + Float64(x + z)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 310000000000.0) tmp = y + (x + z); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 310000000000.0], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 310000000000:\\
\;\;\;\;y + \left(x + z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < 3.1e11Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f6479.3
Simplified79.3%
if 3.1e11 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6444.4
Simplified44.4%
Final simplification68.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Simplified40.7%
herbie shell --seed 2024204
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))