Re: [Tutor] range function and floats?

2011-01-07 Thread Steven D'Aprano
Wayne Werner wrote: On Wed, Jan 5, 2011 at 4:59 PM, Steven D'Aprano wrote: Wayne Werner wrote: I never said rounding errors - I said "pesky floating point errors". When Which ARE rounding errors. They're *all* rounding errors, caused by the same fundamental issue -- the impossibility of r

Re: [Tutor] range function and floats?

2011-01-06 Thread Wayne Werner
On Wed, Jan 5, 2011 at 4:59 PM, Steven D'Aprano wrote: > Wayne Werner wrote: > >> > > I never said rounding errors - I said "pesky floating point errors". When >> > > Which ARE rounding errors. They're *all* rounding errors, caused by the > same fundamental issue -- the impossibility of represe

Re: [Tutor] range function and floats?

2011-01-05 Thread Steven D'Aprano
Wayne Werner wrote: On Wed, Jan 5, 2011 at 10:43 AM, Steven D'Aprano wrote: Wayne Werner wrote: The decimal module allows you to get rid of those pesky floating point errors. See http://docs.python.org/library/decimal.html for more info. That's a myth. Decimal suffers from the same floatin

Re: [Tutor] range function and floats?

2011-01-05 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Wayne Werner wrote: On Wed, Jan 5, 2011 at 10:43 AM, Steven D'Apranowrote: Wayne Werner wrote: The decimal module allows you to get rid of those pesky floating point errors. See http://docs.python.org/library/decimal.html for more info. That's a myth. Decimal s

Re: [Tutor] range function and floats?

2011-01-05 Thread Wayne Werner
On Wed, Jan 5, 2011 at 10:43 AM, Steven D'Aprano wrote: > Wayne Werner wrote: > > The decimal module allows you to get rid of those pesky floating point >> errors. See http://docs.python.org/library/decimal.html for more info. >> > > That's a myth. Decimal suffers from the same floating point iss

Re: [Tutor] range function and floats?

2011-01-05 Thread Steven D'Aprano
Wayne Werner wrote: The decimal module allows you to get rid of those pesky floating point errors. See http://docs.python.org/library/decimal.html for more info. That's a myth. Decimal suffers from the same floating point issues as binary floats. It's quite easy to demonstrate the same sort

Re: [Tutor] range function and floats?

2011-01-05 Thread Wayne Werner
On Wed, Jan 5, 2011 at 5:14 AM, Steven D'Aprano wrote: > Alan Gauld wrote: > > ...this is more about learning how the range function and floats work than >>> about writing a super-efficient program. >>> >> >> Unfortunately they don't work together. >> >> range(0.1,0.5,0.1) -> [0.1,0.2,0.3,0.4]

Re: [Tutor] range function and floats?

2011-01-05 Thread Steven D'Aprano
Alan Gauld wrote: ...this is more about learning how the range function and floats work than about writing a super-efficient program. Unfortunately they don't work together. range(0.1,0.5,0.1) -> [0.1,0.2,0.3,0.4] doesn't work you need to do: for n in range(1,5): use( n/10 ) There ar

Re: [Tutor] range function and floats?

2011-01-05 Thread Alan Gauld
"Joel Knoll" wrote I'm trying to write a simple program to give the sine of each of a range of numbers, including multiples of pi. I keep getting a syntax error, highlighting my use of 2pi as an argument in the range, range requires integers. You need to scale your floats appropriately

[Tutor] range function and floats?

2011-01-05 Thread Joel Knoll
I'm new to Python and to programming in general. I'm trying to write a simple program to give the sine of each of a range of numbers, including multiples of pi. I keep getting a syntax error, highlighting my use of 2pi as an argument in the range, saying something like "expected integers,

Re: [Tutor] range function

2005-01-29 Thread Danny Yoo
On Sat, 29 Jan 2005, Srinivas Iyyer wrote: > I have bunch of coordinates for various vectors. > > small vecs: > > name cord. Xcord. Y Sector no. > smvec175 1001aa > smvec225 50 1aa > smvec3135 1551ab > > large vecs:

[Tutor] range function

2005-01-29 Thread Srinivas Iyyer
Hi: I have bunch of coordinates for various vectors. example: small vecs: name cord. Xcord. Y Sector no. smvec175 1001aa smvec225 50 1aa smvec3135 1551ab large vecs:zone Lvec1 10