Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: Q: Union and precision.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8567] Re: Q: Union and precision.
  • From: Red <red at nym.alias.net>
  • Date: Sat, 6 Sep 1997 23:16:29 -0400
  • Organization: mail2news@nym.alias.net
  • Sender: owner-wri-mathgroup at wolfram.com

-----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.