
(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 14 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 (+ x (+ (* z (cos y)) (sin y))))
double code(double x, double y, double z) {
return x + ((z * cos(y)) + 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 + ((z * cos(y)) + sin(y))
end function
public static double code(double x, double y, double z) {
return x + ((z * Math.cos(y)) + Math.sin(y));
}
def code(x, y, z): return x + ((z * math.cos(y)) + math.sin(y))
function code(x, y, z) return Float64(x + Float64(Float64(z * cos(y)) + sin(y))) end
function tmp = code(x, y, z) tmp = x + ((z * cos(y)) + sin(y)); end
code[x_, y_, z_] := N[(x + N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z \cdot \cos y + \sin y\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.75e+39) (+ x z) (if (<= x 1.15e-73) (+ (* z (cos y)) (sin y)) (+ z (+ x (sin y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+39) {
tmp = x + z;
} else if (x <= 1.15e-73) {
tmp = (z * cos(y)) + sin(y);
} else {
tmp = z + (x + sin(y));
}
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+39)) then
tmp = x + z
else if (x <= 1.15d-73) then
tmp = (z * cos(y)) + sin(y)
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.75e+39) {
tmp = x + z;
} else if (x <= 1.15e-73) {
tmp = (z * Math.cos(y)) + Math.sin(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.75e+39: tmp = x + z elif x <= 1.15e-73: tmp = (z * math.cos(y)) + math.sin(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.75e+39) tmp = Float64(x + z); elseif (x <= 1.15e-73) tmp = Float64(Float64(z * cos(y)) + sin(y)); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.75e+39) tmp = x + z; elseif (x <= 1.15e-73) tmp = (z * cos(y)) + sin(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.75e+39], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.15e-73], N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+39}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-73}:\\
\;\;\;\;z \cdot \cos y + \sin y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if x < -1.7500000000000001e39Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 90.8%
+-commutative90.8%
Simplified90.8%
if -1.7500000000000001e39 < x < 1.14999999999999994e-73Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 93.8%
if 1.14999999999999994e-73 < x Initial program 99.9%
add-cube-cbrt99.8%
pow399.8%
Applied egg-rr99.8%
cube-mult99.8%
add-cube-cbrt99.8%
associate-*l*99.8%
cbrt-unprod99.8%
pow299.8%
pow299.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r*99.8%
rem-cube-cbrt99.7%
pow-plus99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 90.5%
Final simplification92.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -5.4e+184)
t_0
(if (<= z -1.85e-56)
(+ x z)
(if (<= z 8e-60) (+ x (sin y)) (if (<= z 3.7e+191) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -5.4e+184) {
tmp = t_0;
} else if (z <= -1.85e-56) {
tmp = x + z;
} else if (z <= 8e-60) {
tmp = x + sin(y);
} else if (z <= 3.7e+191) {
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 <= (-5.4d+184)) then
tmp = t_0
else if (z <= (-1.85d-56)) then
tmp = x + z
else if (z <= 8d-60) then
tmp = x + sin(y)
else if (z <= 3.7d+191) 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 <= -5.4e+184) {
tmp = t_0;
} else if (z <= -1.85e-56) {
tmp = x + z;
} else if (z <= 8e-60) {
tmp = x + Math.sin(y);
} else if (z <= 3.7e+191) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -5.4e+184: tmp = t_0 elif z <= -1.85e-56: tmp = x + z elif z <= 8e-60: tmp = x + math.sin(y) elif z <= 3.7e+191: 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 <= -5.4e+184) tmp = t_0; elseif (z <= -1.85e-56) tmp = Float64(x + z); elseif (z <= 8e-60) tmp = Float64(x + sin(y)); elseif (z <= 3.7e+191) 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 <= -5.4e+184) tmp = t_0; elseif (z <= -1.85e-56) tmp = x + z; elseif (z <= 8e-60) tmp = x + sin(y); elseif (z <= 3.7e+191) 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, -5.4e+184], t$95$0, If[LessEqual[z, -1.85e-56], N[(x + z), $MachinePrecision], If[LessEqual[z, 8e-60], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+191], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+184}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-56}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-60}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+191}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -5.3999999999999998e184 or 3.70000000000000019e191 < z Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 91.3%
if -5.3999999999999998e184 < z < -1.8500000000000001e-56 or 7.9999999999999998e-60 < z < 3.70000000000000019e191Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 83.7%
+-commutative83.7%
Simplified83.7%
if -1.8500000000000001e-56 < z < 7.9999999999999998e-60Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 96.8%
+-commutative96.8%
Simplified96.8%
Final simplification90.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.35e+184)
t_0
(if (<= z -3e-251)
(+ x z)
(if (<= z 3.1e-64) (sin y) (if (<= z 3.7e+191) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.35e+184) {
tmp = t_0;
} else if (z <= -3e-251) {
tmp = x + z;
} else if (z <= 3.1e-64) {
tmp = sin(y);
} else if (z <= 3.7e+191) {
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 <= (-1.35d+184)) then
tmp = t_0
else if (z <= (-3d-251)) then
tmp = x + z
else if (z <= 3.1d-64) then
tmp = sin(y)
else if (z <= 3.7d+191) 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 <= -1.35e+184) {
tmp = t_0;
} else if (z <= -3e-251) {
tmp = x + z;
} else if (z <= 3.1e-64) {
tmp = Math.sin(y);
} else if (z <= 3.7e+191) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -1.35e+184: tmp = t_0 elif z <= -3e-251: tmp = x + z elif z <= 3.1e-64: tmp = math.sin(y) elif z <= 3.7e+191: 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 <= -1.35e+184) tmp = t_0; elseif (z <= -3e-251) tmp = Float64(x + z); elseif (z <= 3.1e-64) tmp = sin(y); elseif (z <= 3.7e+191) 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 <= -1.35e+184) tmp = t_0; elseif (z <= -3e-251) tmp = x + z; elseif (z <= 3.1e-64) tmp = sin(y); elseif (z <= 3.7e+191) 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, -1.35e+184], t$95$0, If[LessEqual[z, -3e-251], N[(x + z), $MachinePrecision], If[LessEqual[z, 3.1e-64], N[Sin[y], $MachinePrecision], If[LessEqual[z, 3.7e+191], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+184}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-251}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-64}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+191}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.35e184 or 3.70000000000000019e191 < z Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 91.3%
if -1.35e184 < z < -2.9999999999999999e-251 or 3.10000000000000025e-64 < z < 3.70000000000000019e191Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 77.5%
+-commutative77.5%
Simplified77.5%
if -2.9999999999999999e-251 < z < 3.10000000000000025e-64Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 65.2%
Taylor expanded in z around 0 65.2%
Final simplification77.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25e+184) (not (<= z 2.3e+195))) (* z (cos y)) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e+184) || !(z <= 2.3e+195)) {
tmp = z * cos(y);
} else {
tmp = z + (x + sin(y));
}
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.25d+184)) .or. (.not. (z <= 2.3d+195))) then
tmp = z * cos(y)
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e+184) || !(z <= 2.3e+195)) {
tmp = z * Math.cos(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25e+184) or not (z <= 2.3e+195): tmp = z * math.cos(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.25e+184) || !(z <= 2.3e+195)) tmp = Float64(z * cos(y)); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.25e+184) || ~((z <= 2.3e+195))) tmp = z * cos(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25e+184], N[Not[LessEqual[z, 2.3e+195]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+184} \lor \neg \left(z \leq 2.3 \cdot 10^{+195}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -1.25e184 or 2.3000000000000001e195 < z Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 91.3%
if -1.25e184 < z < 2.3000000000000001e195Initial program 99.9%
add-cube-cbrt99.8%
pow399.8%
Applied egg-rr99.8%
cube-mult99.8%
add-cube-cbrt99.8%
associate-*l*99.8%
cbrt-unprod99.8%
pow299.8%
pow299.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r*99.8%
rem-cube-cbrt99.8%
pow-plus99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 92.3%
Final simplification92.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.6e-251) (not (<= z 3.5e-64))) (+ x z) (sin y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.6e-251) || !(z <= 3.5e-64)) {
tmp = x + z;
} else {
tmp = sin(y);
}
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 <= (-5.6d-251)) .or. (.not. (z <= 3.5d-64))) then
tmp = x + z
else
tmp = sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.6e-251) || !(z <= 3.5e-64)) {
tmp = x + z;
} else {
tmp = Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.6e-251) or not (z <= 3.5e-64): tmp = x + z else: tmp = math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.6e-251) || !(z <= 3.5e-64)) tmp = Float64(x + z); else tmp = sin(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.6e-251) || ~((z <= 3.5e-64))) tmp = x + z; else tmp = sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.6e-251], N[Not[LessEqual[z, 3.5e-64]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[Sin[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-251} \lor \neg \left(z \leq 3.5 \cdot 10^{-64}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\sin y\\
\end{array}
\end{array}
if z < -5.59999999999999978e-251 or 3.5000000000000003e-64 < z Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 72.8%
+-commutative72.8%
Simplified72.8%
if -5.59999999999999978e-251 < z < 3.5000000000000003e-64Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around 0 65.2%
Taylor expanded in z around 0 65.2%
Final simplification71.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -2e+33) (not (<= y 0.0058))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2e+33) || !(y <= 0.0058)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
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 <= (-2d+33)) .or. (.not. (y <= 0.0058d0))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2e+33) || !(y <= 0.0058)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2e+33) or not (y <= 0.0058): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2e+33) || !(y <= 0.0058)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2e+33) || ~((y <= 0.0058))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2e+33], N[Not[LessEqual[y, 0.0058]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+33} \lor \neg \left(y \leq 0.0058\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -1.9999999999999999e33 or 0.0058 < y Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 36.6%
+-commutative36.6%
Simplified36.6%
if -1.9999999999999999e33 < y < 0.0058Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 98.5%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+38) (not (<= y 0.0058))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+38) || !(y <= 0.0058)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y))));
}
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 <= (-2.9d+38)) .or. (.not. (y <= 0.0058d0))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+38) || !(y <= 0.0058)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+38) or not (y <= 0.0058): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+38) || !(y <= 0.0058)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.9e+38) || ~((y <= 0.0058))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+38], N[Not[LessEqual[y, 0.0058]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+38} \lor \neg \left(y \leq 0.0058\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -2.90000000000000007e38 or 0.0058 < y Initial program 99.8%
associate-+l+99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in y around 0 36.9%
+-commutative36.9%
Simplified36.9%
if -2.90000000000000007e38 < y < 0.0058Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 97.7%
associate-+r+97.7%
+-commutative97.7%
Simplified97.7%
Final simplification68.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.65e-80) (not (<= x 0.075))) (+ x z) (+ y (+ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.65e-80) || !(x <= 0.075)) {
tmp = x + z;
} else {
tmp = 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 ((x <= (-1.65d-80)) .or. (.not. (x <= 0.075d0))) then
tmp = x + z
else
tmp = y + (x + z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.65e-80) || !(x <= 0.075)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.65e-80) or not (x <= 0.075): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.65e-80) || !(x <= 0.075)) tmp = Float64(x + z); else tmp = Float64(y + Float64(x + z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.65e-80) || ~((x <= 0.075))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.65e-80], N[Not[LessEqual[x, 0.075]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-80} \lor \neg \left(x \leq 0.075\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if x < -1.65e-80 or 0.0749999999999999972 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 86.0%
+-commutative86.0%
Simplified86.0%
if -1.65e-80 < x < 0.0749999999999999972Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 48.9%
+-commutative48.9%
associate-+l+48.9%
Simplified48.9%
Final simplification68.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -9.2e-203) (not (<= x 1.02e-88))) (+ x z) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9.2e-203) || !(x <= 1.02e-88)) {
tmp = x + z;
} else {
tmp = z + y;
}
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.2d-203)) .or. (.not. (x <= 1.02d-88))) then
tmp = x + z
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9.2e-203) || !(x <= 1.02e-88)) {
tmp = x + z;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9.2e-203) or not (x <= 1.02e-88): tmp = x + z else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9.2e-203) || !(x <= 1.02e-88)) tmp = Float64(x + z); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9.2e-203) || ~((x <= 1.02e-88))) tmp = x + z; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9.2e-203], N[Not[LessEqual[x, 1.02e-88]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-203} \lor \neg \left(x \leq 1.02 \cdot 10^{-88}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -9.19999999999999966e-203 or 1.02000000000000001e-88 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 73.2%
+-commutative73.2%
Simplified73.2%
if -9.19999999999999966e-203 < x < 1.02000000000000001e-88Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 53.8%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (if (<= x -7.5e+97) x (if (<= x 2.5e+75) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+97) {
tmp = x;
} else if (x <= 2.5e+75) {
tmp = z + 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 <= (-7.5d+97)) then
tmp = x
else if (x <= 2.5d+75) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+97) {
tmp = x;
} else if (x <= 2.5e+75) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.5e+97: tmp = x elif x <= 2.5e+75: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.5e+97) tmp = x; elseif (x <= 2.5e+75) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.5e+97) tmp = x; elseif (x <= 2.5e+75) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.5e+97], x, If[LessEqual[x, 2.5e+75], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+97}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+75}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.5000000000000004e97 or 2.5000000000000001e75 < x Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 80.7%
if -7.5000000000000004e97 < x < 2.5000000000000001e75Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 85.3%
Taylor expanded in y around 0 42.2%
Final simplification55.0%
(FPCore (x y z) :precision binary64 (if (<= x -7.5e+97) x (if (<= x 2.5e+75) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e+97) {
tmp = x;
} else if (x <= 2.5e+75) {
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 <= (-7.5d+97)) then
tmp = x
else if (x <= 2.5d+75) 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 <= -7.5e+97) {
tmp = x;
} else if (x <= 2.5e+75) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.5e+97: tmp = x elif x <= 2.5e+75: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.5e+97) tmp = x; elseif (x <= 2.5e+75) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.5e+97) tmp = x; elseif (x <= 2.5e+75) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.5e+97], x, If[LessEqual[x, 2.5e+75], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+97}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+75}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.5000000000000004e97 or 2.5000000000000001e75 < x Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 80.7%
if -7.5000000000000004e97 < x < 2.5000000000000001e75Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 85.3%
Taylor expanded in y around 0 36.9%
(FPCore (x y z) :precision binary64 (if (<= x -9.2e-203) x (if (<= x 6.8e-74) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -9.2e-203) {
tmp = x;
} else if (x <= 6.8e-74) {
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 <= (-9.2d-203)) then
tmp = x
else if (x <= 6.8d-74) 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 <= -9.2e-203) {
tmp = x;
} else if (x <= 6.8e-74) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9.2e-203: tmp = x elif x <= 6.8e-74: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9.2e-203) tmp = x; elseif (x <= 6.8e-74) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -9.2e-203) tmp = x; elseif (x <= 6.8e-74) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9.2e-203], x, If[LessEqual[x, 6.8e-74], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-203}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-74}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -9.19999999999999966e-203 or 6.8000000000000001e-74 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 49.0%
if -9.19999999999999966e-203 < x < 6.8000000000000001e-74Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 44.2%
Taylor expanded in y around 0 18.1%
(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%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 37.2%
herbie shell --seed 2024145
(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))))