2008/8/3 CNiall <[EMAIL PROTECTED]>:
> However, with some, but not all, decimals, they do not seem to 'equal
> themselves'.
The golden rule is that working with decimals (in pretty much any
language) is like working with a pile of sand. Almost anything you do
leaves you with less sand and more di
On 3 Aug, 15:02, CNiall <[EMAIL PROTECTED]> wrote:
> However, with some, but not all, decimals, they do not seem to 'equal
> themselves'.
Back in my days studying electrical engineering I was pointed to this
reference about floating point arithmetic -
http://citeseer.ist.psu.edu/goldberg91what.ht
En Tue, 05 Aug 2008 11:50:43 -0300, schinckel <[EMAIL PROTECTED]> escribió:
> I had a class today which dealt with Decimal <-> IEE754 conversion,
> and
> whilst 0.1 was an example that was converted, and a representation was
> generated, no mention was made of the precision issue.
>
> I'm hoping t
On Aug 5, 3:26 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Sun, 03 Aug 2008 19:57:10 -0300, Grant Edwards <[EMAIL PROTECTED]>
> escribi :
>
> > On 2008-08-03, Larry Bates <[EMAIL PROTECTED]> wrote:
>
> >> What are they teaching in computer science classes these days?
>
> > When I was
En Sun, 03 Aug 2008 19:57:10 -0300, Grant Edwards <[EMAIL PROTECTED]>
escribi�:
On 2008-08-03, Larry Bates <[EMAIL PROTECTED]> wrote:
What are they teaching in computer science classes these days?
When I was an undergrad the only courses that dealt with FP
issues were classes on numerica
CNiall wrote:
I am very new to Python (I started learning it just yesterday), but I
have encountered a problem.
I want to make a simple script that calculates the n-th root of a given
number (e.g. 4th root of 625--obviously five, but it's just an example
:P), and because there is no nth-root
On Sun, 03 Aug 2008 17:30:29 -0500, Larry Bates wrote:
>> As you can see, the last two decimals are very slightly inaccurate.
>> However, it appears that when n in 1/n is a power of two, the decimal
>> does not get 'thrown off'. How might I make Python recognise 0.2 as 0.2
>> and not 0.200
On 2008-08-03, Larry Bates <[EMAIL PROTECTED]> wrote:
>> However, it appears that when n in 1/n is a power of two, the decimal
>> does not get 'thrown off'. How might I make Python recognise 0.2 as 0.2
>> and not 0.20001?
>>
>> This discrepancy is very minor, but it makes the whole
On Aug 3, 3:02 pm, CNiall <[EMAIL PROTECTED]> wrote:
> I am very new to Python (I started learning it just yesterday), but I
> have encountered a problem.
>
> I want to make a simple script that calculates the n-th root of a given
> number (e.g. 4th root of 625--obviously five, but it's just an exa
CNiall wrote:
I am very new to Python (I started learning it just yesterday), but I
have encountered a problem.
I want to make a simple script that calculates the n-th root of a given
number (e.g. 4th root of 625--obviously five, but it's just an example
:P), and because there is no nth-root
On Aug 3, 9:02 am, CNiall <[EMAIL PROTECTED]> wrote:
> I am very new to Python (I started learning it just yesterday), but I
> have encountered a problem.
>
> I want to make a simple script that calculates the n-th root of a given
> number (e.g. 4th root of 625--obviously five, but it's just an exa
Jorgen Grahn schrieb:
On Sun, 03 Aug 2008 16:50:22 +0200, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
CNiall schrieb:
...
>>> 0.2
0.20001
...
Welcome to the wonderful world of IEEE754. Just because other languages
shield you from the gory details they still are there. Python ch
On Sun, 03 Aug 2008 16:50:22 +0200, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> CNiall schrieb:
...
>> >>> 0.2
>> 0.20001
...
> Welcome to the wonderful world of IEEE754. Just because other languages
> shield you from the gory details they still are there. Python chose to
> not do
CNiall schrieb:
I am very new to Python (I started learning it just yesterday), but I
have encountered a problem.
I want to make a simple script that calculates the n-th root of a given
number (e.g. 4th root of 625--obviously five, but it's just an example
:P), and because there is no nth-roo
On 3 aug 2008, at 17.16, [EMAIL PROTECTED] wrote:
for nth square root: use math.sqrt n times for example
Ehum. The OP wants to compute the nth root ( not the nth square root)
import math
num = 625
how_many_sqrt = 2
for i in range(how_many_sqrt):
.. num = math.sqrt(num)
..
num
for nth square root: use math.sqrt n times for example
>>> import math
>>> num = 625
>>> how_many_sqrt = 2
>>> for i in range(how_many_sqrt):
.. num = math.sqrt(num)
..
>>> num
5.0
all comparisons work fine for arbitrary floating point numbers...
For readability print them with required prec
CNiall schrieb:
I am very new to Python (I started learning it just yesterday), but I
have encountered a problem.
I want to make a simple script that calculates the n-th root of a given
number (e.g. 4th root of 625--obviously five, but it's just an example
:P), and because there is no nth-roo
17 matches
Mail list logo