
(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 11 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-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.9e-28) (not (<= x 1.1e-139))) (+ z (+ x (sin y))) (+ (sin y) (* z (cos y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.9e-28) || !(x <= 1.1e-139)) {
tmp = z + (x + sin(y));
} else {
tmp = sin(y) + (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 <= (-3.9d-28)) .or. (.not. (x <= 1.1d-139))) then
tmp = z + (x + sin(y))
else
tmp = sin(y) + (z * cos(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.9e-28) || !(x <= 1.1e-139)) {
tmp = z + (x + Math.sin(y));
} else {
tmp = Math.sin(y) + (z * Math.cos(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.9e-28) or not (x <= 1.1e-139): tmp = z + (x + math.sin(y)) else: tmp = math.sin(y) + (z * math.cos(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.9e-28) || !(x <= 1.1e-139)) tmp = Float64(z + Float64(x + sin(y))); else tmp = Float64(sin(y) + Float64(z * cos(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.9e-28) || ~((x <= 1.1e-139))) tmp = z + (x + sin(y)); else tmp = sin(y) + (z * cos(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.9e-28], N[Not[LessEqual[x, 1.1e-139]], $MachinePrecision]], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-28} \lor \neg \left(x \leq 1.1 \cdot 10^{-139}\right):\\
\;\;\;\;z + \left(x + \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\end{array}
\end{array}
if x < -3.89999999999999999e-28 or 1.10000000000000005e-139 < x Initial program 99.9%
Taylor expanded in y around 0 89.8%
if -3.89999999999999999e-28 < x < 1.10000000000000005e-139Initial program 99.9%
Taylor expanded in x around 0 99.9%
Final simplification93.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%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= x -2.8e-28)
(+ z x)
(if (<= x -3.6e-197)
t_0
(if (<= x -6.5e-260)
(sin y)
(if (<= x -2.4e-281)
t_0
(if (<= x 7.5e-258)
(sin y)
(if (<= x 3.4e-130)
t_0
(if (<= x 6e+18)
(+ z (+ y x))
(if (<= x 4.5e+38) t_0 (+ z x)))))))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (x <= -2.8e-28) {
tmp = z + x;
} else if (x <= -3.6e-197) {
tmp = t_0;
} else if (x <= -6.5e-260) {
tmp = sin(y);
} else if (x <= -2.4e-281) {
tmp = t_0;
} else if (x <= 7.5e-258) {
tmp = sin(y);
} else if (x <= 3.4e-130) {
tmp = t_0;
} else if (x <= 6e+18) {
tmp = z + (y + x);
} else if (x <= 4.5e+38) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (x <= (-2.8d-28)) then
tmp = z + x
else if (x <= (-3.6d-197)) then
tmp = t_0
else if (x <= (-6.5d-260)) then
tmp = sin(y)
else if (x <= (-2.4d-281)) then
tmp = t_0
else if (x <= 7.5d-258) then
tmp = sin(y)
else if (x <= 3.4d-130) then
tmp = t_0
else if (x <= 6d+18) then
tmp = z + (y + x)
else if (x <= 4.5d+38) then
tmp = t_0
else
tmp = z + x
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 <= -2.8e-28) {
tmp = z + x;
} else if (x <= -3.6e-197) {
tmp = t_0;
} else if (x <= -6.5e-260) {
tmp = Math.sin(y);
} else if (x <= -2.4e-281) {
tmp = t_0;
} else if (x <= 7.5e-258) {
tmp = Math.sin(y);
} else if (x <= 3.4e-130) {
tmp = t_0;
} else if (x <= 6e+18) {
tmp = z + (y + x);
} else if (x <= 4.5e+38) {
tmp = t_0;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if x <= -2.8e-28: tmp = z + x elif x <= -3.6e-197: tmp = t_0 elif x <= -6.5e-260: tmp = math.sin(y) elif x <= -2.4e-281: tmp = t_0 elif x <= 7.5e-258: tmp = math.sin(y) elif x <= 3.4e-130: tmp = t_0 elif x <= 6e+18: tmp = z + (y + x) elif x <= 4.5e+38: tmp = t_0 else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (x <= -2.8e-28) tmp = Float64(z + x); elseif (x <= -3.6e-197) tmp = t_0; elseif (x <= -6.5e-260) tmp = sin(y); elseif (x <= -2.4e-281) tmp = t_0; elseif (x <= 7.5e-258) tmp = sin(y); elseif (x <= 3.4e-130) tmp = t_0; elseif (x <= 6e+18) tmp = Float64(z + Float64(y + x)); elseif (x <= 4.5e+38) tmp = t_0; else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (x <= -2.8e-28) tmp = z + x; elseif (x <= -3.6e-197) tmp = t_0; elseif (x <= -6.5e-260) tmp = sin(y); elseif (x <= -2.4e-281) tmp = t_0; elseif (x <= 7.5e-258) tmp = sin(y); elseif (x <= 3.4e-130) tmp = t_0; elseif (x <= 6e+18) tmp = z + (y + x); elseif (x <= 4.5e+38) tmp = t_0; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e-28], N[(z + x), $MachinePrecision], If[LessEqual[x, -3.6e-197], t$95$0, If[LessEqual[x, -6.5e-260], N[Sin[y], $MachinePrecision], If[LessEqual[x, -2.4e-281], t$95$0, If[LessEqual[x, 7.5e-258], N[Sin[y], $MachinePrecision], If[LessEqual[x, 3.4e-130], t$95$0, If[LessEqual[x, 6e+18], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e+38], t$95$0, N[(z + x), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{-28}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-197}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-260}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-281}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-258}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-130}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+18}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+38}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -2.7999999999999998e-28 or 4.4999999999999998e38 < x Initial program 99.9%
Taylor expanded in y around 0 88.4%
+-commutative88.4%
Simplified88.4%
if -2.7999999999999998e-28 < x < -3.5999999999999998e-197 or -6.50000000000000002e-260 < x < -2.4e-281 or 7.4999999999999998e-258 < x < 3.40000000000000005e-130 or 6e18 < x < 4.4999999999999998e38Initial program 99.9%
Taylor expanded in z around inf 76.5%
if -3.5999999999999998e-197 < x < -6.50000000000000002e-260 or -2.4e-281 < x < 7.4999999999999998e-258Initial program 99.9%
Taylor expanded in z around 0 78.8%
+-commutative78.8%
Simplified78.8%
Taylor expanded in x around 0 78.7%
if 3.40000000000000005e-130 < x < 6e18Initial program 100.0%
Taylor expanded in y around 0 55.5%
+-commutative55.5%
+-commutative55.5%
associate-+l+55.5%
Simplified55.5%
Final simplification79.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -7e+79)
t_0
(if (<= z -4.6e-6)
(+ z x)
(if (<= z 7.5) (+ x (sin y)) (if (<= z 8.2e+167) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -7e+79) {
tmp = t_0;
} else if (z <= -4.6e-6) {
tmp = z + x;
} else if (z <= 7.5) {
tmp = x + sin(y);
} else if (z <= 8.2e+167) {
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 <= (-7d+79)) then
tmp = t_0
else if (z <= (-4.6d-6)) then
tmp = z + x
else if (z <= 7.5d0) then
tmp = x + sin(y)
else if (z <= 8.2d+167) 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 <= -7e+79) {
tmp = t_0;
} else if (z <= -4.6e-6) {
tmp = z + x;
} else if (z <= 7.5) {
tmp = x + Math.sin(y);
} else if (z <= 8.2e+167) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -7e+79: tmp = t_0 elif z <= -4.6e-6: tmp = z + x elif z <= 7.5: tmp = x + math.sin(y) elif z <= 8.2e+167: 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 <= -7e+79) tmp = t_0; elseif (z <= -4.6e-6) tmp = Float64(z + x); elseif (z <= 7.5) tmp = Float64(x + sin(y)); elseif (z <= 8.2e+167) 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 <= -7e+79) tmp = t_0; elseif (z <= -4.6e-6) tmp = z + x; elseif (z <= 7.5) tmp = x + sin(y); elseif (z <= 8.2e+167) 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, -7e+79], t$95$0, If[LessEqual[z, -4.6e-6], N[(z + x), $MachinePrecision], If[LessEqual[z, 7.5], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e+167], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -7 \cdot 10^{+79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-6}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 7.5:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+167}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -6.99999999999999961e79 or 8.2e167 < z Initial program 99.8%
Taylor expanded in z around inf 85.2%
if -6.99999999999999961e79 < z < -4.6e-6 or 7.5 < z < 8.2e167Initial program 99.9%
Taylor expanded in y around 0 81.6%
+-commutative81.6%
Simplified81.6%
if -4.6e-6 < z < 7.5Initial program 100.0%
Taylor expanded in z around 0 96.5%
+-commutative96.5%
Simplified96.5%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -7e+80) (not (<= z 1.25e+167))) (* z (cos y)) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7e+80) || !(z <= 1.25e+167)) {
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 <= (-7d+80)) .or. (.not. (z <= 1.25d+167))) 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 <= -7e+80) || !(z <= 1.25e+167)) {
tmp = z * Math.cos(y);
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7e+80) or not (z <= 1.25e+167): tmp = z * math.cos(y) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7e+80) || !(z <= 1.25e+167)) 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 <= -7e+80) || ~((z <= 1.25e+167))) tmp = z * cos(y); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7e+80], N[Not[LessEqual[z, 1.25e+167]], $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 -7 \cdot 10^{+80} \lor \neg \left(z \leq 1.25 \cdot 10^{+167}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -6.99999999999999987e80 or 1.2499999999999999e167 < z Initial program 99.8%
Taylor expanded in z around inf 85.2%
if -6.99999999999999987e80 < z < 1.2499999999999999e167Initial program 100.0%
Taylor expanded in y around 0 93.1%
Final simplification91.0%
(FPCore (x y z) :precision binary64 (if (<= x -1.3e-195) (+ z x) (if (<= x 3.2e-156) (sin y) (if (<= x 2.15e-5) (+ z (+ y x)) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-195) {
tmp = z + x;
} else if (x <= 3.2e-156) {
tmp = sin(y);
} else if (x <= 2.15e-5) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.3d-195)) then
tmp = z + x
else if (x <= 3.2d-156) then
tmp = sin(y)
else if (x <= 2.15d-5) then
tmp = z + (y + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-195) {
tmp = z + x;
} else if (x <= 3.2e-156) {
tmp = Math.sin(y);
} else if (x <= 2.15e-5) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.3e-195: tmp = z + x elif x <= 3.2e-156: tmp = math.sin(y) elif x <= 2.15e-5: tmp = z + (y + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.3e-195) tmp = Float64(z + x); elseif (x <= 3.2e-156) tmp = sin(y); elseif (x <= 2.15e-5) tmp = Float64(z + Float64(y + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.3e-195) tmp = z + x; elseif (x <= 3.2e-156) tmp = sin(y); elseif (x <= 2.15e-5) tmp = z + (y + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.3e-195], N[(z + x), $MachinePrecision], If[LessEqual[x, 3.2e-156], N[Sin[y], $MachinePrecision], If[LessEqual[x, 2.15e-5], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-195}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-156}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-5}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -1.3000000000000001e-195 or 2.1500000000000001e-5 < x Initial program 99.9%
Taylor expanded in y around 0 80.2%
+-commutative80.2%
Simplified80.2%
if -1.3000000000000001e-195 < x < 3.19999999999999982e-156Initial program 99.9%
Taylor expanded in z around 0 53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in x around 0 53.4%
if 3.19999999999999982e-156 < x < 2.1500000000000001e-5Initial program 99.9%
Taylor expanded in y around 0 57.6%
+-commutative57.6%
+-commutative57.6%
associate-+l+57.6%
Simplified57.6%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (<= x -2.7e-21) (+ z x) (if (<= x 1.22e-8) (+ z (+ y x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e-21) {
tmp = z + x;
} else if (x <= 1.22e-8) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.7d-21)) then
tmp = z + x
else if (x <= 1.22d-8) then
tmp = z + (y + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e-21) {
tmp = z + x;
} else if (x <= 1.22e-8) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.7e-21: tmp = z + x elif x <= 1.22e-8: tmp = z + (y + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.7e-21) tmp = Float64(z + x); elseif (x <= 1.22e-8) tmp = Float64(z + Float64(y + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.7e-21) tmp = z + x; elseif (x <= 1.22e-8) tmp = z + (y + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.7e-21], N[(z + x), $MachinePrecision], If[LessEqual[x, 1.22e-8], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-21}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-8}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -2.7000000000000001e-21 or 1.22e-8 < x Initial program 99.9%
Taylor expanded in y around 0 87.8%
+-commutative87.8%
Simplified87.8%
if -2.7000000000000001e-21 < x < 1.22e-8Initial program 99.9%
Taylor expanded in y around 0 48.8%
+-commutative48.8%
+-commutative48.8%
associate-+l+48.8%
Simplified48.8%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (<= x -2.5e-22) x (if (<= x 6.8e-33) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e-22) {
tmp = x;
} else if (x <= 6.8e-33) {
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 <= (-2.5d-22)) then
tmp = x
else if (x <= 6.8d-33) 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 <= -2.5e-22) {
tmp = x;
} else if (x <= 6.8e-33) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.5e-22: tmp = x elif x <= 6.8e-33: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.5e-22) tmp = x; elseif (x <= 6.8e-33) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.5e-22) tmp = x; elseif (x <= 6.8e-33) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.5e-22], x, If[LessEqual[x, 6.8e-33], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-33}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.49999999999999977e-22 or 6.8000000000000001e-33 < x Initial program 99.9%
Taylor expanded in x around inf 76.2%
if -2.49999999999999977e-22 < x < 6.8000000000000001e-33Initial program 99.9%
Taylor expanded in z around inf 55.7%
Taylor expanded in y around 0 35.1%
Final simplification57.7%
(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%
Taylor expanded in y around 0 64.0%
+-commutative64.0%
Simplified64.0%
Final simplification64.0%
(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 45.2%
Final simplification45.2%
herbie shell --seed 2023275
(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))))