
(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 15 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 (fma (cos y) z (+ x (sin y))))
double code(double x, double y, double z) {
return fma(cos(y), z, (x + sin(y)));
}
function code(x, y, z) return fma(cos(y), z, Float64(x + sin(y))) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
sin-lowering-sin.f6499.9%
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (if (<= z -3.05e-35) (fma (cos y) z x) (if (<= z 2.1e-53) (+ x (sin y)) (* z (+ (cos y) (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.05e-35) {
tmp = fma(cos(y), z, x);
} else if (z <= 2.1e-53) {
tmp = x + sin(y);
} else {
tmp = z * (cos(y) + (x / z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -3.05e-35) tmp = fma(cos(y), z, x); elseif (z <= 2.1e-53) tmp = Float64(x + sin(y)); else tmp = Float64(z * Float64(cos(y) + Float64(x / z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -3.05e-35], N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[z, 2.1e-53], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z * N[(N[Cos[y], $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-53}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\cos y + \frac{x}{z}\right)\\
\end{array}
\end{array}
if z < -3.05e-35Initial program 99.8%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
sin-lowering-sin.f6499.9%
Applied egg-rr99.9%
Taylor expanded in x around inf
Simplified97.4%
if -3.05e-35 < z < 2.09999999999999977e-53Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6497.9%
Simplified97.9%
if 2.09999999999999977e-53 < z Initial program 99.9%
flip-+N/A
div-invN/A
difference-of-squaresN/A
associate-*l*N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
Applied egg-rr99.8%
Taylor expanded in z around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6499.9%
Simplified99.9%
Taylor expanded in y around 0
/-lowering-/.f6499.8%
Simplified99.8%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (+ (* (cos y) z) (+ x (sin y))))
double code(double x, double y, double z) {
return (cos(y) * z) + (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 = (cos(y) * z) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (Math.cos(y) * z) + (x + Math.sin(y));
}
def code(x, y, z): return (math.cos(y) * z) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(cos(y) * z) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (cos(y) * z) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos y \cdot z + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -9.2e+200)
t_0
(if (<= z -5e-35)
(+ z x)
(if (<= z 1.7e-73) (+ x (sin y)) (if (<= z 2e+125) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -9.2e+200) {
tmp = t_0;
} else if (z <= -5e-35) {
tmp = z + x;
} else if (z <= 1.7e-73) {
tmp = x + sin(y);
} else if (z <= 2e+125) {
tmp = z + x;
} 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 = cos(y) * z
if (z <= (-9.2d+200)) then
tmp = t_0
else if (z <= (-5d-35)) then
tmp = z + x
else if (z <= 1.7d-73) then
tmp = x + sin(y)
else if (z <= 2d+125) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cos(y) * z;
double tmp;
if (z <= -9.2e+200) {
tmp = t_0;
} else if (z <= -5e-35) {
tmp = z + x;
} else if (z <= 1.7e-73) {
tmp = x + Math.sin(y);
} else if (z <= 2e+125) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -9.2e+200: tmp = t_0 elif z <= -5e-35: tmp = z + x elif z <= 1.7e-73: tmp = x + math.sin(y) elif z <= 2e+125: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -9.2e+200) tmp = t_0; elseif (z <= -5e-35) tmp = Float64(z + x); elseif (z <= 1.7e-73) tmp = Float64(x + sin(y)); elseif (z <= 2e+125) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -9.2e+200) tmp = t_0; elseif (z <= -5e-35) tmp = z + x; elseif (z <= 1.7e-73) tmp = x + sin(y); elseif (z <= 2e+125) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -9.2e+200], t$95$0, If[LessEqual[z, -5e-35], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.7e-73], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+125], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-35}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-73}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+125}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.20000000000000013e200 or 1.9999999999999998e125 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6496.2%
Simplified96.2%
if -9.20000000000000013e200 < z < -4.99999999999999964e-35 or 1.7000000000000001e-73 < z < 1.9999999999999998e125Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6483.7%
Simplified83.7%
if -4.99999999999999964e-35 < z < 1.7000000000000001e-73Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6497.8%
Simplified97.8%
Final simplification92.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -1.9e+197)
t_0
(if (<= z -2.55e-98)
(+ z x)
(if (<= z -5e-169) (sin y) (if (<= z 1.26e+125) (+ y (+ z x)) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -1.9e+197) {
tmp = t_0;
} else if (z <= -2.55e-98) {
tmp = z + x;
} else if (z <= -5e-169) {
tmp = sin(y);
} else if (z <= 1.26e+125) {
tmp = y + (z + x);
} 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 = cos(y) * z
if (z <= (-1.9d+197)) then
tmp = t_0
else if (z <= (-2.55d-98)) then
tmp = z + x
else if (z <= (-5d-169)) then
tmp = sin(y)
else if (z <= 1.26d+125) then
tmp = y + (z + x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cos(y) * z;
double tmp;
if (z <= -1.9e+197) {
tmp = t_0;
} else if (z <= -2.55e-98) {
tmp = z + x;
} else if (z <= -5e-169) {
tmp = Math.sin(y);
} else if (z <= 1.26e+125) {
tmp = y + (z + x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -1.9e+197: tmp = t_0 elif z <= -2.55e-98: tmp = z + x elif z <= -5e-169: tmp = math.sin(y) elif z <= 1.26e+125: tmp = y + (z + x) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -1.9e+197) tmp = t_0; elseif (z <= -2.55e-98) tmp = Float64(z + x); elseif (z <= -5e-169) tmp = sin(y); elseif (z <= 1.26e+125) tmp = Float64(y + Float64(z + x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -1.9e+197) tmp = t_0; elseif (z <= -2.55e-98) tmp = z + x; elseif (z <= -5e-169) tmp = sin(y); elseif (z <= 1.26e+125) tmp = y + (z + x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.9e+197], t$95$0, If[LessEqual[z, -2.55e-98], N[(z + x), $MachinePrecision], If[LessEqual[z, -5e-169], N[Sin[y], $MachinePrecision], If[LessEqual[z, 1.26e+125], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.55 \cdot 10^{-98}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-169}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;z \leq 1.26 \cdot 10^{+125}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.9000000000000001e197 or 1.25999999999999993e125 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6496.2%
Simplified96.2%
if -1.9000000000000001e197 < z < -2.55000000000000011e-98Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6480.1%
Simplified80.1%
if -2.55000000000000011e-98 < z < -5.0000000000000002e-169Initial program 100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6484.0%
Simplified84.0%
Taylor expanded in z around 0
sin-lowering-sin.f6484.0%
Simplified84.0%
if -5.0000000000000002e-169 < z < 1.25999999999999993e125Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f6469.9%
Simplified69.9%
Final simplification79.4%
(FPCore (x y z) :precision binary64 (if (<= z -2.9e-37) (+ x (* (cos y) z)) (if (<= z 5.8e-48) (+ x (sin y)) (* z (+ (cos y) (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e-37) {
tmp = x + (cos(y) * z);
} else if (z <= 5.8e-48) {
tmp = x + sin(y);
} else {
tmp = z * (cos(y) + (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 (z <= (-2.9d-37)) then
tmp = x + (cos(y) * z)
else if (z <= 5.8d-48) then
tmp = x + sin(y)
else
tmp = z * (cos(y) + (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e-37) {
tmp = x + (Math.cos(y) * z);
} else if (z <= 5.8e-48) {
tmp = x + Math.sin(y);
} else {
tmp = z * (Math.cos(y) + (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.9e-37: tmp = x + (math.cos(y) * z) elif z <= 5.8e-48: tmp = x + math.sin(y) else: tmp = z * (math.cos(y) + (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.9e-37) tmp = Float64(x + Float64(cos(y) * z)); elseif (z <= 5.8e-48) tmp = Float64(x + sin(y)); else tmp = Float64(z * Float64(cos(y) + Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.9e-37) tmp = x + (cos(y) * z); elseif (z <= 5.8e-48) tmp = x + sin(y); else tmp = z * (cos(y) + (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.9e-37], N[(x + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-48], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z * N[(N[Cos[y], $MachinePrecision] + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-37}:\\
\;\;\;\;x + \cos y \cdot z\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-48}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\cos y + \frac{x}{z}\right)\\
\end{array}
\end{array}
if z < -2.90000000000000005e-37Initial program 99.8%
Taylor expanded in x around inf
Simplified97.4%
if -2.90000000000000005e-37 < z < 5.8000000000000006e-48Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6497.9%
Simplified97.9%
if 5.8000000000000006e-48 < z Initial program 99.9%
flip-+N/A
div-invN/A
difference-of-squaresN/A
associate-*l*N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
Applied egg-rr99.8%
Taylor expanded in z around -inf
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6499.9%
Simplified99.9%
Taylor expanded in y around 0
/-lowering-/.f6499.8%
Simplified99.8%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (* (cos y) z)))) (if (<= z -4.1e-34) t_0 (if (<= z 3.2e-71) (+ x (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + (cos(y) * z);
double tmp;
if (z <= -4.1e-34) {
tmp = t_0;
} else if (z <= 3.2e-71) {
tmp = 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 = x + (cos(y) * z)
if (z <= (-4.1d-34)) then
tmp = t_0
else if (z <= 3.2d-71) then
tmp = 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 = x + (Math.cos(y) * z);
double tmp;
if (z <= -4.1e-34) {
tmp = t_0;
} else if (z <= 3.2e-71) {
tmp = x + Math.sin(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (math.cos(y) * z) tmp = 0 if z <= -4.1e-34: tmp = t_0 elif z <= 3.2e-71: tmp = x + math.sin(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(cos(y) * z)) tmp = 0.0 if (z <= -4.1e-34) tmp = t_0; elseif (z <= 3.2e-71) tmp = Float64(x + sin(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (cos(y) * z); tmp = 0.0; if (z <= -4.1e-34) tmp = t_0; elseif (z <= 3.2e-71) tmp = x + sin(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e-34], t$95$0, If[LessEqual[z, 3.2e-71], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y \cdot z\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-71}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.1000000000000004e-34 or 3.1999999999999999e-71 < z Initial program 99.9%
Taylor expanded in x around inf
Simplified98.7%
if -4.1000000000000004e-34 < z < 3.1999999999999999e-71Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6497.8%
Simplified97.8%
Final simplification98.3%
(FPCore (x y z)
:precision binary64
(if (<= y -3.4e+252)
(sin y)
(if (<= y -1.2e+42)
(+ z x)
(if (<= y 2.15e+29) (+ (+ z x) (* y (+ 1.0 (* y (* z -0.5))))) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.4e+252) {
tmp = sin(y);
} else if (y <= -1.2e+42) {
tmp = z + x;
} else if (y <= 2.15e+29) {
tmp = (z + x) + (y * (1.0 + (y * (z * -0.5))));
} else {
tmp = z + 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 (y <= (-3.4d+252)) then
tmp = sin(y)
else if (y <= (-1.2d+42)) then
tmp = z + x
else if (y <= 2.15d+29) then
tmp = (z + x) + (y * (1.0d0 + (y * (z * (-0.5d0)))))
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.4e+252) {
tmp = Math.sin(y);
} else if (y <= -1.2e+42) {
tmp = z + x;
} else if (y <= 2.15e+29) {
tmp = (z + x) + (y * (1.0 + (y * (z * -0.5))));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.4e+252: tmp = math.sin(y) elif y <= -1.2e+42: tmp = z + x elif y <= 2.15e+29: tmp = (z + x) + (y * (1.0 + (y * (z * -0.5)))) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.4e+252) tmp = sin(y); elseif (y <= -1.2e+42) tmp = Float64(z + x); elseif (y <= 2.15e+29) tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(y * Float64(z * -0.5))))); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.4e+252) tmp = sin(y); elseif (y <= -1.2e+42) tmp = z + x; elseif (y <= 2.15e+29) tmp = (z + x) + (y * (1.0 + (y * (z * -0.5)))); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.4e+252], N[Sin[y], $MachinePrecision], If[LessEqual[y, -1.2e+42], N[(z + x), $MachinePrecision], If[LessEqual[y, 2.15e+29], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(y * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+252}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{+42}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+29}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + y \cdot \left(z \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -3.4e252Initial program 99.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6489.9%
Simplified89.9%
Taylor expanded in z around 0
sin-lowering-sin.f6454.5%
Simplified54.5%
if -3.4e252 < y < -1.1999999999999999e42 or 2.1500000000000001e29 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6439.6%
Simplified39.6%
if -1.1999999999999999e42 < y < 2.1500000000000001e29Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6495.7%
Simplified95.7%
(FPCore (x y z) :precision binary64 (if (<= y -1.3e+42) (+ z x) (if (<= y 2.1e+27) (+ (+ z x) (* y (+ 1.0 (* y (* z -0.5))))) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e+42) {
tmp = z + x;
} else if (y <= 2.1e+27) {
tmp = (z + x) + (y * (1.0 + (y * (z * -0.5))));
} else {
tmp = z + 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 (y <= (-1.3d+42)) then
tmp = z + x
else if (y <= 2.1d+27) then
tmp = (z + x) + (y * (1.0d0 + (y * (z * (-0.5d0)))))
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e+42) {
tmp = z + x;
} else if (y <= 2.1e+27) {
tmp = (z + x) + (y * (1.0 + (y * (z * -0.5))));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.3e+42: tmp = z + x elif y <= 2.1e+27: tmp = (z + x) + (y * (1.0 + (y * (z * -0.5)))) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.3e+42) tmp = Float64(z + x); elseif (y <= 2.1e+27) tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(y * Float64(z * -0.5))))); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.3e+42) tmp = z + x; elseif (y <= 2.1e+27) tmp = (z + x) + (y * (1.0 + (y * (z * -0.5)))); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.3e+42], N[(z + x), $MachinePrecision], If[LessEqual[y, 2.1e+27], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(y * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+42}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+27}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + y \cdot \left(z \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.29999999999999995e42 or 2.09999999999999995e27 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6436.0%
Simplified36.0%
if -1.29999999999999995e42 < y < 2.09999999999999995e27Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6495.7%
Simplified95.7%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e+49) x (if (<= y 2e+27) (+ y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+49) {
tmp = x;
} else if (y <= 2e+27) {
tmp = y + (z + x);
} else {
tmp = z + 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 (y <= (-3.8d+49)) then
tmp = x
else if (y <= 2d+27) then
tmp = y + (z + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+49) {
tmp = x;
} else if (y <= 2e+27) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+49: tmp = x elif y <= 2e+27: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+49) tmp = x; elseif (y <= 2e+27) tmp = Float64(y + Float64(z + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.8e+49) tmp = x; elseif (y <= 2e+27) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+49], x, If[LessEqual[y, 2e+27], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+49}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+27}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -3.7999999999999999e49Initial program 99.8%
Taylor expanded in x around inf
Simplified39.6%
if -3.7999999999999999e49 < y < 2e27Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f6495.1%
Simplified95.1%
if 2e27 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6431.8%
Simplified31.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.05e-123) (+ z x) (if (<= x 1.32e-157) (+ y z) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.05e-123) {
tmp = z + x;
} else if (x <= 1.32e-157) {
tmp = y + z;
} else {
tmp = z + 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 <= (-1.05d-123)) then
tmp = z + x
else if (x <= 1.32d-157) then
tmp = y + z
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.05e-123) {
tmp = z + x;
} else if (x <= 1.32e-157) {
tmp = y + z;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.05e-123: tmp = z + x elif x <= 1.32e-157: tmp = y + z else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.05e-123) tmp = Float64(z + x); elseif (x <= 1.32e-157) tmp = Float64(y + z); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.05e-123) tmp = z + x; elseif (x <= 1.32e-157) tmp = y + z; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.05e-123], N[(z + x), $MachinePrecision], If[LessEqual[x, 1.32e-157], N[(y + z), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-123}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-157}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -1.05e-123 or 1.3200000000000001e-157 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6475.2%
Simplified75.2%
if -1.05e-123 < x < 1.3200000000000001e-157Initial program 99.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.2%
Simplified99.2%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6458.1%
Simplified58.1%
Final simplification70.3%
(FPCore (x y z) :precision binary64 (if (<= z -9e-132) (+ z x) (if (<= z 3.4e-224) (+ y x) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e-132) {
tmp = z + x;
} else if (z <= 3.4e-224) {
tmp = y + x;
} else {
tmp = z + 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 (z <= (-9d-132)) then
tmp = z + x
else if (z <= 3.4d-224) then
tmp = y + x
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9e-132) {
tmp = z + x;
} else if (z <= 3.4e-224) {
tmp = y + x;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e-132: tmp = z + x elif z <= 3.4e-224: tmp = y + x else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e-132) tmp = Float64(z + x); elseif (z <= 3.4e-224) tmp = Float64(y + x); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e-132) tmp = z + x; elseif (z <= 3.4e-224) tmp = y + x; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e-132], N[(z + x), $MachinePrecision], If[LessEqual[z, 3.4e-224], N[(y + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-132}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-224}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -8.9999999999999999e-132 or 3.39999999999999992e-224 < z Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6469.5%
Simplified69.5%
if -8.9999999999999999e-132 < z < 3.39999999999999992e-224Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f64100.0%
Simplified100.0%
Taylor expanded in y around 0
Simplified64.2%
(FPCore (x y z) :precision binary64 (if (<= x -1.4e-25) x (if (<= x 6.4e-19) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-25) {
tmp = x;
} else if (x <= 6.4e-19) {
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 <= (-1.4d-25)) then
tmp = x
else if (x <= 6.4d-19) 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 <= -1.4e-25) {
tmp = x;
} else if (x <= 6.4e-19) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.4e-25: tmp = x elif x <= 6.4e-19: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.4e-25) tmp = x; elseif (x <= 6.4e-19) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.4e-25) tmp = x; elseif (x <= 6.4e-19) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.4e-25], x, If[LessEqual[x, 6.4e-19], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-19}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.39999999999999994e-25 or 6.39999999999999965e-19 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified69.1%
if -1.39999999999999994e-25 < x < 6.39999999999999965e-19Initial program 99.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6492.7%
Simplified92.7%
Taylor expanded in y around 0
Simplified39.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.16e-122) x (if (<= x 5.1e-158) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.16e-122) {
tmp = x;
} else if (x <= 5.1e-158) {
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 <= (-1.16d-122)) then
tmp = x
else if (x <= 5.1d-158) 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 <= -1.16e-122) {
tmp = x;
} else if (x <= 5.1e-158) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.16e-122: tmp = x elif x <= 5.1e-158: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.16e-122) tmp = x; elseif (x <= 5.1e-158) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.16e-122) tmp = x; elseif (x <= 5.1e-158) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.16e-122], x, If[LessEqual[x, 5.1e-158], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.16 \cdot 10^{-122}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{-158}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.16000000000000001e-122 or 5.1000000000000003e-158 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified54.5%
if -1.16000000000000001e-122 < x < 5.1000000000000003e-158Initial program 99.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6499.2%
Simplified99.2%
Taylor expanded in z around 0
sin-lowering-sin.f6443.4%
Simplified43.4%
Taylor expanded in y around 0
Simplified21.4%
(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
Simplified39.8%
herbie shell --seed 2024192
(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))))