Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6812

Re: float("nan") in set or as key

Date 2011-06-01 11:10 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: float("nan") in set or as key
References <d63a1808-e704-4538-8541-9edeadab2135@glegroupsg2000goo.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2376.1306950997.9059.python-list@python.org> (permalink)

Show all headers | View raw


Carl Banks wrote:
> For instance, say you are using an implementation that uses
 > floating point, and you define a function that uses Newton's
 > method to find a square root:
> 
> def square_root(N,x=None):
>     if x is None:
>         x = N/2
>     for i in range(100):
>         x = (x + N/x)/2
>     return x
> 
> It works pretty well on your floating-point implementation.
 > Now try running it on an implementation that uses fractions
 > by default....
> 
> (Seriously, try running this function with N as a Fraction.)

Okay, will this thing ever stop?  It's been running for 90 minutes now. 
  Is it just incredibly slow?

Any enlightenment appreciated!

~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: float("nan") in set or as key Carl Banks <pavlovevidence@gmail.com> - 2011-05-31 23:09 -0700
  Re: float("nan") in set or as key "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-06-01 17:17 +0000
  Re: float("nan") in set or as key Ethan Furman <ethan@stoneleaf.us> - 2011-06-01 11:10 -0700
    Re: float("nan") in set or as key Chris Torek <nospam@torek.net> - 2011-06-01 18:29 +0000

csiph-web