
(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 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (<= z -0.66) (+ x (* z (cos y))) (if (<= z 1.6) (+ z (+ x (sin y))) (fma z (cos y) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.66) {
tmp = x + (z * cos(y));
} else if (z <= 1.6) {
tmp = z + (x + sin(y));
} else {
tmp = fma(z, cos(y), x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.66) tmp = Float64(x + Float64(z * cos(y))); elseif (z <= 1.6) tmp = Float64(z + Float64(x + sin(y))); else tmp = fma(z, cos(y), x); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -0.66], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.66:\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{elif}\;z \leq 1.6:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \cos y, x\right)\\
\end{array}
\end{array}
if z < -0.660000000000000031Initial program 99.8%
Taylor expanded in x around inf 98.8%
if -0.660000000000000031 < z < 1.6000000000000001Initial program 100.0%
Taylor expanded in y around 0 98.5%
if 1.6000000000000001 < z Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.0%
(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}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -8.8e-35)
(+ z x)
(if (<= x -3.1e-152)
(sin y)
(if (<= x 2.25e-297)
(+ z (+ y x))
(if (<= x 5.6e-126) (sin y) (+ z x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.8e-35) {
tmp = z + x;
} else if (x <= -3.1e-152) {
tmp = sin(y);
} else if (x <= 2.25e-297) {
tmp = z + (y + x);
} else if (x <= 5.6e-126) {
tmp = sin(y);
} 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 <= (-8.8d-35)) then
tmp = z + x
else if (x <= (-3.1d-152)) then
tmp = sin(y)
else if (x <= 2.25d-297) then
tmp = z + (y + x)
else if (x <= 5.6d-126) then
tmp = sin(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -8.8e-35) {
tmp = z + x;
} else if (x <= -3.1e-152) {
tmp = Math.sin(y);
} else if (x <= 2.25e-297) {
tmp = z + (y + x);
} else if (x <= 5.6e-126) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.8e-35: tmp = z + x elif x <= -3.1e-152: tmp = math.sin(y) elif x <= 2.25e-297: tmp = z + (y + x) elif x <= 5.6e-126: tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.8e-35) tmp = Float64(z + x); elseif (x <= -3.1e-152) tmp = sin(y); elseif (x <= 2.25e-297) tmp = Float64(z + Float64(y + x)); elseif (x <= 5.6e-126) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.8e-35) tmp = z + x; elseif (x <= -3.1e-152) tmp = sin(y); elseif (x <= 2.25e-297) tmp = z + (y + x); elseif (x <= 5.6e-126) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.8e-35], N[(z + x), $MachinePrecision], If[LessEqual[x, -3.1e-152], N[Sin[y], $MachinePrecision], If[LessEqual[x, 2.25e-297], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e-126], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{-35}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-152}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-297}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-126}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -8.79999999999999975e-35 or 5.59999999999999983e-126 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 84.1%
if -8.79999999999999975e-35 < x < -3.0999999999999998e-152 or 2.24999999999999988e-297 < x < 5.59999999999999983e-126Initial program 99.9%
Taylor expanded in y around 0 75.2%
Taylor expanded in x around 0 73.5%
Taylor expanded in z around 0 55.4%
if -3.0999999999999998e-152 < x < 2.24999999999999988e-297Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 48.1%
associate-+r+48.1%
+-commutative48.1%
Simplified48.1%
Final simplification72.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -6.8e+65)
t_0
(if (<= z 1.45e-52) (+ x (sin y)) (if (<= z 1.05e+147) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -6.8e+65) {
tmp = t_0;
} else if (z <= 1.45e-52) {
tmp = x + sin(y);
} else if (z <= 1.05e+147) {
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 = z * cos(y)
if (z <= (-6.8d+65)) then
tmp = t_0
else if (z <= 1.45d-52) then
tmp = x + sin(y)
else if (z <= 1.05d+147) 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 = z * Math.cos(y);
double tmp;
if (z <= -6.8e+65) {
tmp = t_0;
} else if (z <= 1.45e-52) {
tmp = x + Math.sin(y);
} else if (z <= 1.05e+147) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -6.8e+65: tmp = t_0 elif z <= 1.45e-52: tmp = x + math.sin(y) elif z <= 1.05e+147: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -6.8e+65) tmp = t_0; elseif (z <= 1.45e-52) tmp = Float64(x + sin(y)); elseif (z <= 1.05e+147) tmp = Float64(z + x); 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 <= -6.8e+65) tmp = t_0; elseif (z <= 1.45e-52) tmp = x + sin(y); elseif (z <= 1.05e+147) tmp = z + x; 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, -6.8e+65], t$95$0, If[LessEqual[z, 1.45e-52], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+147], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-52}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+147}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.7999999999999999e65 or 1.05000000000000003e147 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 85.2%
if -6.7999999999999999e65 < z < 1.4500000000000001e-52Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 91.6%
+-commutative91.6%
Simplified91.6%
if 1.4500000000000001e-52 < z < 1.05000000000000003e147Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 74.9%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.88) (not (<= z 3.5))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.88) || !(z <= 3.5)) {
tmp = x + (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 <= (-0.88d0)) .or. (.not. (z <= 3.5d0))) then
tmp = x + (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 <= -0.88) || !(z <= 3.5)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.88) or not (z <= 3.5): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.88) || !(z <= 3.5)) tmp = Float64(x + 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 <= -0.88) || ~((z <= 3.5))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.88], N[Not[LessEqual[z, 3.5]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.88 \lor \neg \left(z \leq 3.5\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -0.880000000000000004 or 3.5 < z Initial program 99.9%
Taylor expanded in x around inf 99.3%
if -0.880000000000000004 < z < 3.5Initial program 100.0%
Taylor expanded in y around 0 98.5%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.4e-34) (not (<= z 4.6e-42))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.4e-34) || !(z <= 4.6e-42)) {
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 <= (-7.4d-34)) .or. (.not. (z <= 4.6d-42))) 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 <= -7.4e-34) || !(z <= 4.6e-42)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.4e-34) or not (z <= 4.6e-42): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.4e-34) || !(z <= 4.6e-42)) 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 <= -7.4e-34) || ~((z <= 4.6e-42))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.4e-34], N[Not[LessEqual[z, 4.6e-42]], $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 -7.4 \cdot 10^{-34} \lor \neg \left(z \leq 4.6 \cdot 10^{-42}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -7.39999999999999976e-34 or 4.60000000000000008e-42 < z Initial program 99.9%
Taylor expanded in x around inf 97.1%
if -7.39999999999999976e-34 < z < 4.60000000000000008e-42Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 96.1%
+-commutative96.1%
Simplified96.1%
Final simplification96.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.1e-30) (not (<= x 1.8e-107))) (+ z x) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.1e-30) || !(x <= 1.8e-107)) {
tmp = z + x;
} else {
tmp = z * cos(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.1d-30)) .or. (.not. (x <= 1.8d-107))) then
tmp = z + x
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.1e-30) || !(x <= 1.8e-107)) {
tmp = z + x;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.1e-30) or not (x <= 1.8e-107): tmp = z + x else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.1e-30) || !(x <= 1.8e-107)) tmp = Float64(z + x); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.1e-30) || ~((x <= 1.8e-107))) tmp = z + x; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.1e-30], N[Not[LessEqual[x, 1.8e-107]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-30} \lor \neg \left(x \leq 1.8 \cdot 10^{-107}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if x < -1.09999999999999992e-30 or 1.79999999999999988e-107 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 84.4%
if -1.09999999999999992e-30 < x < 1.79999999999999988e-107Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 57.8%
Final simplification74.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.1e+96) (not (<= y 320000.0))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1e+96) || !(y <= 320000.0)) {
tmp = z + x;
} else {
tmp = z + (y + 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.1d+96)) .or. (.not. (y <= 320000.0d0))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.1e+96) || !(y <= 320000.0)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.1e+96) or not (y <= 320000.0): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.1e+96) || !(y <= 320000.0)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.1e+96) || ~((y <= 320000.0))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.1e+96], N[Not[LessEqual[y, 320000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+96} \lor \neg \left(y \leq 320000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -3.0999999999999998e96 or 3.2e5 < y Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 40.7%
if -3.0999999999999998e96 < y < 3.2e5Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 94.0%
associate-+r+94.0%
+-commutative94.0%
Simplified94.0%
Final simplification68.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.92e-81) (not (<= x 8.6e-101))) (+ z x) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.92e-81) || !(x <= 8.6e-101)) {
tmp = z + x;
} 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 <= (-1.92d-81)) .or. (.not. (x <= 8.6d-101))) then
tmp = z + x
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.92e-81) || !(x <= 8.6e-101)) {
tmp = z + x;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.92e-81) or not (x <= 8.6e-101): tmp = z + x else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.92e-81) || !(x <= 8.6e-101)) tmp = Float64(z + x); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.92e-81) || ~((x <= 8.6e-101))) tmp = z + x; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.92e-81], N[Not[LessEqual[x, 8.6e-101]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.92 \cdot 10^{-81} \lor \neg \left(x \leq 8.6 \cdot 10^{-101}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -1.92000000000000007e-81 or 8.5999999999999995e-101 < x Initial program 99.9%
+-commutative99.9%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 81.0%
if -1.92000000000000007e-81 < x < 8.5999999999999995e-101Initial program 99.9%
Taylor expanded in y around 0 70.6%
Taylor expanded in x around 0 70.1%
Taylor expanded in y around 0 41.2%
+-commutative41.2%
Simplified41.2%
Final simplification67.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.02e+130) z (if (<= z 2.25e+198) x z)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.02e+130) {
tmp = z;
} else if (z <= 2.25e+198) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.02d+130)) then
tmp = z
else if (z <= 2.25d+198) then
tmp = x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.02e+130) {
tmp = z;
} else if (z <= 2.25e+198) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.02e+130: tmp = z elif z <= 2.25e+198: tmp = x else: tmp = z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.02e+130) tmp = z; elseif (z <= 2.25e+198) tmp = x; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.02e+130) tmp = z; elseif (z <= 2.25e+198) tmp = x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.02e+130], z, If[LessEqual[z, 2.25e+198], x, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+130}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+198}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.01999999999999999e130 or 2.25000000000000001e198 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 93.2%
Taylor expanded in y around 0 54.0%
if -1.01999999999999999e130 < z < 2.25000000000000001e198Initial program 100.0%
add-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 55.5%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 63.7%
Final simplification63.7%
(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%
add-log-exp99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 42.9%
herbie shell --seed 2024181
(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))))