
(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 12 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 (+ x (* z (cos y))))) (if (<= z -1850000.0) t_0 (if (<= z 1.25) (+ z (+ x (sin y))) t_0))))
double code(double x, double y, double z) {
double t_0 = x + (z * cos(y));
double tmp;
if (z <= -1850000.0) {
tmp = t_0;
} else if (z <= 1.25) {
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 = x + (z * cos(y))
if (z <= (-1850000.0d0)) then
tmp = t_0
else if (z <= 1.25d0) 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 = x + (z * Math.cos(y));
double tmp;
if (z <= -1850000.0) {
tmp = t_0;
} else if (z <= 1.25) {
tmp = z + (x + Math.sin(y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (z * math.cos(y)) tmp = 0 if z <= -1850000.0: tmp = t_0 elif z <= 1.25: tmp = z + (x + math.sin(y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(z * cos(y))) tmp = 0.0 if (z <= -1850000.0) tmp = t_0; elseif (z <= 1.25) tmp = Float64(z + Float64(x + sin(y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (z * cos(y)); tmp = 0.0; if (z <= -1850000.0) tmp = t_0; elseif (z <= 1.25) tmp = z + (x + sin(y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1850000.0], t$95$0, If[LessEqual[z, 1.25], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + z \cdot \cos y\\
\mathbf{if}\;z \leq -1850000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.25:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.85e6 or 1.25 < z Initial program 99.8%
Taylor expanded in x around inf
Simplified99.1%
if -1.85e6 < z < 1.25Initial program 100.0%
Taylor expanded in y around 0
Simplified99.6%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (* z (cos y))))) (if (<= z -7.5e-38) t_0 (if (<= z 1.85e-17) (+ x (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + (z * cos(y));
double tmp;
if (z <= -7.5e-38) {
tmp = t_0;
} else if (z <= 1.85e-17) {
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 + (z * cos(y))
if (z <= (-7.5d-38)) then
tmp = t_0
else if (z <= 1.85d-17) 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 + (z * Math.cos(y));
double tmp;
if (z <= -7.5e-38) {
tmp = t_0;
} else if (z <= 1.85e-17) {
tmp = x + Math.sin(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (z * math.cos(y)) tmp = 0 if z <= -7.5e-38: tmp = t_0 elif z <= 1.85e-17: tmp = x + math.sin(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(z * cos(y))) tmp = 0.0 if (z <= -7.5e-38) tmp = t_0; elseif (z <= 1.85e-17) tmp = Float64(x + sin(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (z * cos(y)); tmp = 0.0; if (z <= -7.5e-38) tmp = t_0; elseif (z <= 1.85e-17) tmp = x + sin(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e-38], t$95$0, If[LessEqual[z, 1.85e-17], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + z \cdot \cos y\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-17}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.5e-38 or 1.8499999999999999e-17 < z Initial program 99.9%
Taylor expanded in x around inf
Simplified97.9%
if -7.5e-38 < z < 1.8499999999999999e-17Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6495.8%
Simplified95.8%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (cos y)))) (if (<= z -190000000.0) t_0 (if (<= z 128000.0) (+ x (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -190000000.0) {
tmp = t_0;
} else if (z <= 128000.0) {
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 = z * cos(y)
if (z <= (-190000000.0d0)) then
tmp = t_0
else if (z <= 128000.0d0) 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 = z * Math.cos(y);
double tmp;
if (z <= -190000000.0) {
tmp = t_0;
} else if (z <= 128000.0) {
tmp = 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 <= -190000000.0: tmp = t_0 elif z <= 128000.0: tmp = 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 <= -190000000.0) tmp = t_0; elseif (z <= 128000.0) tmp = 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 <= -190000000.0) tmp = t_0; elseif (z <= 128000.0) tmp = 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, -190000000.0], t$95$0, If[LessEqual[z, 128000.0], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -190000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 128000:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.9e8 or 128000 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6476.8%
Simplified76.8%
if -1.9e8 < z < 128000Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6493.3%
Simplified93.3%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (if (<= x -2.4e-53) (+ x z) (if (<= x 1.95e-7) (* z (cos y)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.4e-53) {
tmp = x + z;
} else if (x <= 1.95e-7) {
tmp = z * cos(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) :: tmp
if (x <= (-2.4d-53)) then
tmp = x + z
else if (x <= 1.95d-7) then
tmp = z * cos(y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.4e-53) {
tmp = x + z;
} else if (x <= 1.95e-7) {
tmp = z * Math.cos(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.4e-53: tmp = x + z elif x <= 1.95e-7: tmp = z * math.cos(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.4e-53) tmp = Float64(x + z); elseif (x <= 1.95e-7) tmp = Float64(z * cos(y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.4e-53) tmp = x + z; elseif (x <= 1.95e-7) tmp = z * cos(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.4e-53], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.95e-7], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-53}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-7}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -2.40000000000000007e-53 or 1.95000000000000012e-7 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6487.1%
Simplified87.1%
if -2.40000000000000007e-53 < x < 1.95000000000000012e-7Initial program 99.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6462.2%
Simplified62.2%
Final simplification75.4%
(FPCore (x y z) :precision binary64 (if (<= y -215000000.0) (+ x z) (if (<= y 0.0115) (+ (+ x y) (* z (+ 1.0 (* y (* y -0.5))))) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -215000000.0) {
tmp = x + z;
} else if (y <= 0.0115) {
tmp = (x + y) + (z * (1.0 + (y * (y * -0.5))));
} 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 <= (-215000000.0d0)) then
tmp = x + z
else if (y <= 0.0115d0) then
tmp = (x + y) + (z * (1.0d0 + (y * (y * (-0.5d0)))))
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -215000000.0) {
tmp = x + z;
} else if (y <= 0.0115) {
tmp = (x + y) + (z * (1.0 + (y * (y * -0.5))));
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -215000000.0: tmp = x + z elif y <= 0.0115: tmp = (x + y) + (z * (1.0 + (y * (y * -0.5)))) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -215000000.0) tmp = Float64(x + z); elseif (y <= 0.0115) tmp = Float64(Float64(x + y) + Float64(z * Float64(1.0 + Float64(y * Float64(y * -0.5))))); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -215000000.0) tmp = x + z; elseif (y <= 0.0115) tmp = (x + y) + (z * (1.0 + (y * (y * -0.5)))); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -215000000.0], N[(x + z), $MachinePrecision], If[LessEqual[y, 0.0115], N[(N[(x + y), $MachinePrecision] + N[(z * N[(1.0 + N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -215000000:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 0.0115:\\
\;\;\;\;\left(x + y\right) + z \cdot \left(1 + y \cdot \left(y \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -2.15e8 or 0.0115 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6438.1%
Simplified38.1%
if -2.15e8 < y < 0.0115Initial program 100.0%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-+r+N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
Simplified98.7%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= y -7.6e+21) (+ x z) (if (<= y 0.000125) (+ z (+ x y)) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.6e+21) {
tmp = x + z;
} else if (y <= 0.000125) {
tmp = z + (x + 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) :: tmp
if (y <= (-7.6d+21)) then
tmp = x + z
else if (y <= 0.000125d0) then
tmp = z + (x + y)
else
tmp = x + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.6e+21) {
tmp = x + z;
} else if (y <= 0.000125) {
tmp = z + (x + y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.6e+21: tmp = x + z elif y <= 0.000125: tmp = z + (x + y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.6e+21) tmp = Float64(x + z); elseif (y <= 0.000125) tmp = Float64(z + Float64(x + y)); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.6e+21) tmp = x + z; elseif (y <= 0.000125) tmp = z + (x + y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.6e+21], N[(x + z), $MachinePrecision], If[LessEqual[y, 0.000125], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+21}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 0.000125:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -7.6e21 or 1.25e-4 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6437.2%
Simplified37.2%
if -7.6e21 < y < 1.25e-4Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f6497.4%
Simplified97.4%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.75e-161) (+ x z) (if (<= x 4.5e-54) (+ y z) (+ x z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e-161) {
tmp = x + z;
} else if (x <= 4.5e-54) {
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 <= (-1.75d-161)) then
tmp = x + z
else if (x <= 4.5d-54) 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 <= -1.75e-161) {
tmp = x + z;
} else if (x <= 4.5e-54) {
tmp = y + z;
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.75e-161: tmp = x + z elif x <= 4.5e-54: tmp = y + z else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.75e-161) tmp = Float64(x + z); elseif (x <= 4.5e-54) 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 <= -1.75e-161) tmp = x + z; elseif (x <= 4.5e-54) tmp = y + z; else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.75e-161], N[(x + z), $MachinePrecision], If[LessEqual[x, 4.5e-54], N[(y + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-161}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-54}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if x < -1.7500000000000001e-161 or 4.4999999999999998e-54 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6476.1%
Simplified76.1%
if -1.7500000000000001e-161 < x < 4.4999999999999998e-54Initial program 99.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6498.4%
Simplified98.4%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6452.3%
Simplified52.3%
Final simplification67.6%
(FPCore (x y z) :precision binary64 (if (<= x -420.0) x (if (<= x 1.5e-66) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -420.0) {
tmp = x;
} else if (x <= 1.5e-66) {
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 <= (-420.0d0)) then
tmp = x
else if (x <= 1.5d-66) 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 <= -420.0) {
tmp = x;
} else if (x <= 1.5e-66) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -420.0: tmp = x elif x <= 1.5e-66: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -420.0) tmp = x; elseif (x <= 1.5e-66) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -420.0) tmp = x; elseif (x <= 1.5e-66) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -420.0], x, If[LessEqual[x, 1.5e-66], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -420:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-66}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -420 or 1.5000000000000001e-66 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified71.1%
if -420 < x < 1.5000000000000001e-66Initial program 99.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
sin-lowering-sin.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6494.7%
Simplified94.7%
Taylor expanded in y around 0
Simplified34.4%
(FPCore (x y z) :precision binary64 (if (<= x -6.2e-162) x (if (<= x 5.5e-64) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6.2e-162) {
tmp = x;
} else if (x <= 5.5e-64) {
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.2d-162)) then
tmp = x
else if (x <= 5.5d-64) 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.2e-162) {
tmp = x;
} else if (x <= 5.5e-64) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6.2e-162: tmp = x elif x <= 5.5e-64: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6.2e-162) tmp = x; elseif (x <= 5.5e-64) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6.2e-162) tmp = x; elseif (x <= 5.5e-64) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6.2e-162], x, If[LessEqual[x, 5.5e-64], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-162}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-64}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.1999999999999997e-162 or 5.4999999999999999e-64 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified61.8%
if -6.1999999999999997e-162 < x < 5.4999999999999999e-64Initial program 99.9%
Taylor expanded in y around 0
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
unpow2N/A
associate-+r+N/A
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lft-identityN/A
associate-*r*N/A
distribute-rgt-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
Simplified54.4%
Taylor expanded in y around inf
unpow2N/A
associate-*l*N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
rgt-mult-inverseN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r*N/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6419.1%
Simplified19.1%
Taylor expanded in y around 0
Simplified19.3%
(FPCore (x y z) :precision binary64 (+ x z))
double code(double x, double y, double z) {
return x + z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + z
end function
public static double code(double x, double y, double z) {
return x + z;
}
def code(x, y, z): return x + z
function code(x, y, z) return Float64(x + z) end
function tmp = code(x, y, z) tmp = x + z; end
code[x_, y_, z_] := N[(x + z), $MachinePrecision]
\begin{array}{l}
\\
x + z
\end{array}
Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6462.9%
Simplified62.9%
Final simplification62.9%
(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
Simplified41.8%
herbie shell --seed 2024158
(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))))