MathGroup Archive 2009

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

Search the Archive

Re: An arithmetic puzzle, equality of numbers.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103102] Re: An arithmetic puzzle, equality of numbers.
  • From: ADL <alberto.dilullo at tiscali.it>
  • Date: Tue, 8 Sep 2009 05:57:10 -0400 (EDT)
  • References: <h829m8$3ue$1@smc.vnet.net>

But,

For[ i = 1.11111111111111111111, i > 0, Print[i = 2.*i - i] ]
or
For[ i = 1.11111111111111111111, i > 0, Print[i = N[2*i - i]] ]

works as expected (I use Mathematica 7).

It is just a matter of avoid mixing infinite precision numbers with
machine numbers, which is not a brilliant idea anyway in any algebra
system, as several times discussed.

Enjoy

ADL

On Sep 7, 8:36 am, Richard Fateman <fate... at cs.berkeley.edu> wrote:
> For[i = 1.11111111111111111111, i > 0, Print[i = 2*i - i]]
>
> This came to my attention (again), and I thought it might amuse
> current readers of this newsgroup.
>
> What looks like an infinite loop terminates with i==0 being true.  also
> i==2 is true.  (Tested in Mathematica 6.0; I don't have access to 7 yet.)



  • Prev by Date: Re: An arithmetic puzzle, equality of numbers.
  • Next by Date: Re: An arithmetic puzzle, equality of numbers.
  • Previous by thread: Re: An arithmetic puzzle, equality of numbers.
  • Next by thread: Re: An arithmetic puzzle, equality of numbers.