17 lines
278 B
Mathematica
17 lines
278 B
Mathematica
|
|
function judge = NearZero(near)
|
||
|
|
% *** BASIC HELPER FUNCTIONS ***
|
||
|
|
% Takes a scalar.
|
||
|
|
% Checks if the scalar is small enough to be neglected.
|
||
|
|
% Example Input:
|
||
|
|
%
|
||
|
|
% clear; clc;
|
||
|
|
% near = -1e-7;
|
||
|
|
% judge = NearZero(near)
|
||
|
|
%
|
||
|
|
% Output:
|
||
|
|
% judge =
|
||
|
|
% 1
|
||
|
|
|
||
|
|
judge = norm(near) < 1e-6;
|
||
|
|
end
|