
(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)))) (if (or (<= x -1.08e-47) (not (<= x 2.5e-47))) (+ x t_0) (+ (sin y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if ((x <= -1.08e-47) || !(x <= 2.5e-47)) {
tmp = x + t_0;
} else {
tmp = sin(y) + 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 ((x <= (-1.08d-47)) .or. (.not. (x <= 2.5d-47))) then
tmp = x + t_0
else
tmp = sin(y) + 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 ((x <= -1.08e-47) || !(x <= 2.5e-47)) {
tmp = x + t_0;
} else {
tmp = Math.sin(y) + t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if (x <= -1.08e-47) or not (x <= 2.5e-47): tmp = x + t_0 else: tmp = math.sin(y) + t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if ((x <= -1.08e-47) || !(x <= 2.5e-47)) tmp = Float64(x + t_0); else tmp = Float64(sin(y) + t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if ((x <= -1.08e-47) || ~((x <= 2.5e-47))) tmp = x + t_0; else tmp = sin(y) + t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.08e-47], N[Not[LessEqual[x, 2.5e-47]], $MachinePrecision]], N[(x + t$95$0), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -1.08 \cdot 10^{-47} \lor \neg \left(x \leq 2.5 \cdot 10^{-47}\right):\\
\;\;\;\;x + t\_0\\
\mathbf{else}:\\
\;\;\;\;\sin y + t\_0\\
\end{array}
\end{array}
if x < -1.08000000000000005e-47 or 2.50000000000000006e-47 < x Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around inf 97.9%
if -1.08000000000000005e-47 < x < 2.50000000000000006e-47Initial program 99.9%
Taylor expanded in x around 0 97.3%
Final simplification97.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.18e+54)
t_0
(if (<= z -1.7e-166)
(+ x z)
(if (<= z 3.3e-244) (+ z (+ x y)) (if (<= z 1.3e+61) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.18e+54) {
tmp = t_0;
} else if (z <= -1.7e-166) {
tmp = x + z;
} else if (z <= 3.3e-244) {
tmp = z + (x + y);
} else if (z <= 1.3e+61) {
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.18d+54)) then
tmp = t_0
else if (z <= (-1.7d-166)) then
tmp = x + z
else if (z <= 3.3d-244) then
tmp = z + (x + y)
else if (z <= 1.3d+61) 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.18e+54) {
tmp = t_0;
} else if (z <= -1.7e-166) {
tmp = x + z;
} else if (z <= 3.3e-244) {
tmp = z + (x + y);
} else if (z <= 1.3e+61) {
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.18e+54: tmp = t_0 elif z <= -1.7e-166: tmp = x + z elif z <= 3.3e-244: tmp = z + (x + y) elif z <= 1.3e+61: 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.18e+54) tmp = t_0; elseif (z <= -1.7e-166) tmp = Float64(x + z); elseif (z <= 3.3e-244) tmp = Float64(z + Float64(x + y)); elseif (z <= 1.3e+61) 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.18e+54) tmp = t_0; elseif (z <= -1.7e-166) tmp = x + z; elseif (z <= 3.3e-244) tmp = z + (x + y); elseif (z <= 1.3e+61) 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.18e+54], t$95$0, If[LessEqual[z, -1.7e-166], N[(x + z), $MachinePrecision], If[LessEqual[z, 3.3e-244], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+61], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -1.18 \cdot 10^{+54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-166}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-244}:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+61}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.1799999999999999e54 or 1.29999999999999986e61 < z Initial program 99.8%
Taylor expanded in z around inf 88.8%
if -1.1799999999999999e54 < z < -1.6999999999999999e-166 or 3.30000000000000026e-244 < z < 1.29999999999999986e61Initial program 100.0%
Taylor expanded in y around 0 79.0%
+-commutative79.0%
Simplified79.0%
if -1.6999999999999999e-166 < z < 3.30000000000000026e-244Initial program 99.9%
Taylor expanded in y around 0 77.5%
+-commutative77.5%
+-commutative77.5%
associate-+l+77.5%
Simplified77.5%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -1.6e+54)
t_0
(if (<= z -2.8e-63) (+ x z) (if (<= z 1.1e+40) (+ x (sin y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -1.6e+54) {
tmp = t_0;
} else if (z <= -2.8e-63) {
tmp = x + z;
} else if (z <= 1.1e+40) {
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 <= (-1.6d+54)) then
tmp = t_0
else if (z <= (-2.8d-63)) then
tmp = x + z
else if (z <= 1.1d+40) 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 <= -1.6e+54) {
tmp = t_0;
} else if (z <= -2.8e-63) {
tmp = x + z;
} else if (z <= 1.1e+40) {
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 <= -1.6e+54: tmp = t_0 elif z <= -2.8e-63: tmp = x + z elif z <= 1.1e+40: 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 <= -1.6e+54) tmp = t_0; elseif (z <= -2.8e-63) tmp = Float64(x + z); elseif (z <= 1.1e+40) 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 <= -1.6e+54) tmp = t_0; elseif (z <= -2.8e-63) tmp = x + z; elseif (z <= 1.1e+40) 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, -1.6e+54], t$95$0, If[LessEqual[z, -2.8e-63], N[(x + z), $MachinePrecision], If[LessEqual[z, 1.1e+40], 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 -1.6 \cdot 10^{+54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-63}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+40}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.6e54 or 1.0999999999999999e40 < z Initial program 99.8%
Taylor expanded in z around inf 87.4%
if -1.6e54 < z < -2.8000000000000002e-63Initial program 100.0%
Taylor expanded in y around 0 86.1%
+-commutative86.1%
Simplified86.1%
if -2.8000000000000002e-63 < z < 1.0999999999999999e40Initial program 99.9%
Taylor expanded in z around 0 87.3%
+-commutative87.3%
Simplified87.3%
Final simplification87.2%
(FPCore (x y z) :precision binary64 (if (<= y -9.5e+24) (+ x z) (if (<= y 7.8e+31) (+ z (+ x y)) (if (<= y 1.45e+167) (sin y) (+ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.5e+24) {
tmp = x + z;
} else if (y <= 7.8e+31) {
tmp = z + (x + y);
} else if (y <= 1.45e+167) {
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) :: tmp
if (y <= (-9.5d+24)) then
tmp = x + z
else if (y <= 7.8d+31) then
tmp = z + (x + y)
else if (y <= 1.45d+167) 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 tmp;
if (y <= -9.5e+24) {
tmp = x + z;
} else if (y <= 7.8e+31) {
tmp = z + (x + y);
} else if (y <= 1.45e+167) {
tmp = Math.sin(y);
} else {
tmp = x + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.5e+24: tmp = x + z elif y <= 7.8e+31: tmp = z + (x + y) elif y <= 1.45e+167: tmp = math.sin(y) else: tmp = x + z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.5e+24) tmp = Float64(x + z); elseif (y <= 7.8e+31) tmp = Float64(z + Float64(x + y)); elseif (y <= 1.45e+167) tmp = sin(y); else tmp = Float64(x + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.5e+24) tmp = x + z; elseif (y <= 7.8e+31) tmp = z + (x + y); elseif (y <= 1.45e+167) tmp = sin(y); else tmp = x + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.5e+24], N[(x + z), $MachinePrecision], If[LessEqual[y, 7.8e+31], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+167], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+24}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+31}:\\
\;\;\;\;z + \left(x + y\right)\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+167}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;x + z\\
\end{array}
\end{array}
if y < -9.5000000000000001e24 or 1.44999999999999987e167 < y Initial program 99.8%
Taylor expanded in y around 0 42.9%
+-commutative42.9%
Simplified42.9%
if -9.5000000000000001e24 < y < 7.79999999999999999e31Initial program 100.0%
Taylor expanded in y around 0 96.5%
+-commutative96.5%
+-commutative96.5%
associate-+l+96.5%
Simplified96.5%
if 7.79999999999999999e31 < y < 1.44999999999999987e167Initial program 99.7%
Taylor expanded in x around inf 99.7%
Taylor expanded in z around 0 62.7%
+-commutative62.7%
Simplified62.7%
Taylor expanded in x around 0 45.1%
Final simplification73.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.5e-64) (not (<= z 2.05e-11))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e-64) || !(z <= 2.05e-11)) {
tmp = x + (z * cos(y));
} else {
tmp = 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 <= (-9.5d-64)) .or. (.not. (z <= 2.05d-11))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e-64) || !(z <= 2.05e-11)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.5e-64) or not (z <= 2.05e-11): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.5e-64) || !(z <= 2.05e-11)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -9.5e-64) || ~((z <= 2.05e-11))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.5e-64], N[Not[LessEqual[z, 2.05e-11]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-64} \lor \neg \left(z \leq 2.05 \cdot 10^{-11}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -9.50000000000000043e-64 or 2.05e-11 < z Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in x around inf 98.1%
if -9.50000000000000043e-64 < z < 2.05e-11Initial program 100.0%
Taylor expanded in z around 0 89.9%
+-commutative89.9%
Simplified89.9%
Final simplification94.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.2e+22) (not (<= y 8e+31))) (+ x z) (+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+22) || !(y <= 8e+31)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * (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 <= (-7.2d+22)) .or. (.not. (y <= 8d+31))) then
tmp = x + z
else
tmp = x + (z + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+22) || !(y <= 8e+31)) {
tmp = x + z;
} else {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.2e+22) or not (y <= 8e+31): tmp = x + z else: tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.2e+22) || !(y <= 8e+31)) tmp = Float64(x + z); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.2e+22) || ~((y <= 8e+31))) tmp = x + z; else tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.2e+22], N[Not[LessEqual[y, 8e+31]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+22} \lor \neg \left(y \leq 8 \cdot 10^{+31}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -7.2e22 or 7.9999999999999997e31 < y Initial program 99.8%
Taylor expanded in y around 0 38.4%
+-commutative38.4%
Simplified38.4%
if -7.2e22 < y < 7.9999999999999997e31Initial program 100.0%
Taylor expanded in y around 0 94.9%
Taylor expanded in z around 0 95.9%
*-commutative95.9%
Simplified95.9%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -66000.0) (not (<= y 235.0))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* y z)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -66000.0) || !(y <= 235.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * 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 <= (-66000.0d0)) .or. (.not. (y <= 235.0d0))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (y * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -66000.0) || !(y <= 235.0)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -66000.0) or not (y <= 235.0): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -66000.0) || !(y <= 235.0)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -66000.0) || ~((y <= 235.0))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (y * z)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -66000.0], N[Not[LessEqual[y, 235.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -66000 \lor \neg \left(y \leq 235\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -66000 or 235 < y Initial program 99.8%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -66000 < y < 235Initial program 100.0%
Taylor expanded in y around 0 99.6%
associate-+r+99.6%
+-commutative99.6%
*-commutative99.6%
Simplified99.6%
Final simplification71.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.3e+22) (not (<= y 4.1e-8))) (+ x z) (+ z (+ x y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.3e+22) || !(y <= 4.1e-8)) {
tmp = x + z;
} else {
tmp = z + (x + 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 <= (-3.3d+22)) .or. (.not. (y <= 4.1d-8))) then
tmp = x + z
else
tmp = z + (x + y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.3e+22) || !(y <= 4.1e-8)) {
tmp = x + z;
} else {
tmp = z + (x + y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.3e+22) or not (y <= 4.1e-8): tmp = x + z else: tmp = z + (x + y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.3e+22) || !(y <= 4.1e-8)) tmp = Float64(x + z); else tmp = Float64(z + Float64(x + y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.3e+22) || ~((y <= 4.1e-8))) tmp = x + z; else tmp = z + (x + y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.3e+22], N[Not[LessEqual[y, 4.1e-8]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+22} \lor \neg \left(y \leq 4.1 \cdot 10^{-8}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.2999999999999998e22 or 4.10000000000000032e-8 < y Initial program 99.8%
Taylor expanded in y around 0 39.7%
+-commutative39.7%
Simplified39.7%
if -3.2999999999999998e22 < y < 4.10000000000000032e-8Initial program 100.0%
Taylor expanded in y around 0 97.3%
+-commutative97.3%
+-commutative97.3%
associate-+l+97.3%
Simplified97.3%
Final simplification71.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.5e-106) (not (<= x 4.8e-231))) (+ x z) (+ y z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e-106) || !(x <= 4.8e-231)) {
tmp = x + z;
} else {
tmp = y + 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.5d-106)) .or. (.not. (x <= 4.8d-231))) then
tmp = x + z
else
tmp = y + z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e-106) || !(x <= 4.8e-231)) {
tmp = x + z;
} else {
tmp = y + z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.5e-106) or not (x <= 4.8e-231): tmp = x + z else: tmp = y + z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.5e-106) || !(x <= 4.8e-231)) tmp = Float64(x + z); else tmp = Float64(y + z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.5e-106) || ~((x <= 4.8e-231))) tmp = x + z; else tmp = y + z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.5e-106], N[Not[LessEqual[x, 4.8e-231]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-106} \lor \neg \left(x \leq 4.8 \cdot 10^{-231}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + z\\
\end{array}
\end{array}
if x < -4.49999999999999955e-106 or 4.79999999999999983e-231 < x Initial program 99.9%
Taylor expanded in y around 0 73.0%
+-commutative73.0%
Simplified73.0%
if -4.49999999999999955e-106 < x < 4.79999999999999983e-231Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 59.4%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (<= x -6e+24) x (if (<= x 2.05e+58) (+ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -6e+24) {
tmp = x;
} else if (x <= 2.05e+58) {
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 <= (-6d+24)) then
tmp = x
else if (x <= 2.05d+58) 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 <= -6e+24) {
tmp = x;
} else if (x <= 2.05e+58) {
tmp = y + z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -6e+24: tmp = x elif x <= 2.05e+58: tmp = y + z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -6e+24) tmp = x; elseif (x <= 2.05e+58) tmp = Float64(y + z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -6e+24) tmp = x; elseif (x <= 2.05e+58) tmp = y + z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -6e+24], x, If[LessEqual[x, 2.05e+58], N[(y + z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+58}:\\
\;\;\;\;y + z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.9999999999999999e24 or 2.05e58 < x Initial program 99.9%
Taylor expanded in x around inf 77.0%
if -5.9999999999999999e24 < x < 2.05e58Initial program 99.9%
Taylor expanded in x around 0 93.9%
Taylor expanded in y around 0 51.1%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (if (<= x -7.2e+24) x (if (<= x 2.05e+58) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.2e+24) {
tmp = x;
} else if (x <= 2.05e+58) {
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.2d+24)) then
tmp = x
else if (x <= 2.05d+58) 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.2e+24) {
tmp = x;
} else if (x <= 2.05e+58) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.2e+24: tmp = x elif x <= 2.05e+58: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.2e+24) tmp = x; elseif (x <= 2.05e+58) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.2e+24) tmp = x; elseif (x <= 2.05e+58) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.2e+24], x, If[LessEqual[x, 2.05e+58], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+58}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.19999999999999966e24 or 2.05e58 < x Initial program 99.9%
Taylor expanded in x around inf 77.0%
if -7.19999999999999966e24 < x < 2.05e58Initial program 99.9%
Taylor expanded in x around 0 93.9%
Taylor expanded in y around 0 45.7%
Final simplification60.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%
Taylor expanded in x around inf 39.8%
Final simplification39.8%
herbie shell --seed 2024079
(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))))