Is there a "normal" EqualQ function in Mathematica? -
on documentation page equal
read
approximate numbers machine precision or higher considered equal if differ in @ last 7 binary digits (roughly last 2 decimal digits).
here examples (32 bit system; 64 bit system add more zeros in middle):
in[1]:= 1.0000000000000021 == 1.0000000000000022 1.0000000000000021 === 1.0000000000000022 out[1]= true out[2]= true
i'm wondering there "normal" analog of equal
function in mathematica not drop last 7 binary digits?
in[12]:= myequal[x_, y_] := order[x, y] == 0 in[13]:= myequal[1.0000000000000021, 1.0000000000000022] out[13]= false in[14]:= myequal[1.0000000000000021, 1.0000000000000021] out[14]= true
this tests if 2 object identical, since 1.0000000000000021 , 1.000000000000002100 differs in precision won't considered identical.
Comments
Post a Comment