MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Q: Union and precision.


-----BEGIN PGP SIGNED MESSAGE-----

Gadi Oron <oron at manet.pmmh.espci.fr> wrote
 in <5uleeq$cp6 at smc.vnet.net>:
>How can I force Union to consider numbers equal in the current 
>precision as equal? Explanation:
>
>In:=    a=SetPrecision[1.234567,2]
>Out:=   1.2
>
>In:=    b=SetPrecision[1.234561,2]  (* Notice difference *)
>Out:=   1.2
>
>In:=    a==b
>Out:=   True
>
>In:=    Union[{a,b}]
>Out:=   {1.2,1.2} (* !!! *)

Do this:

Union[ {a,b}, SameTest->Equal]

Equal is ==


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBNBDgNLcaab4ltFhVAQFkSgP+OHSssXcpHuM5anIKlB5lYzG2NOmgAzKE
v6FVU4w7+GQ39yDptz58QMkReF0+0vzGQfhIIAL6xkxd3CtGgVZaOgpTCFuovDgL
DchyHLYGF5Ac/z6+dP0hQEf4G5VXIELieEE8Tb+pyPK/ubiGHrHpMyQXy38Mn7Tq
cL3HT0z4phk=
=sFcP
-----END PGP SIGNATURE-----


  • Prev by Date: RE: Q: Union and precision.
  • Next by Date: Re: Plot help needed
  • Previous by thread: RE: Q: Union and precision.
  • Next by thread: Re: Q: Union and precision.