On Fri, 15 Apr 2016 12:05:18 +0100, John Pote wrote:
> On 15/04/2016 03:38, Christian Gollwitzer wrote:
>> Am 15.04.16 um 02:36 schrieb Dennis Lee Bieber:
> I should also have said that the square root of integer squares with
> between 15 and 30 decimal digits will only be correct if the s
On 15/04/2016 03:38, Christian Gollwitzer wrote:
Am 15.04.16 um 02:36 schrieb Dennis Lee Bieber:
I should also have said that the square root of integer squares with
between 15 and 30 decimal digits will only be correct if the square
numbers themselves are exactly representable in 53 bits. So
On 15/04/2016 01:36, Dennis Lee Bieber wrote:
> On Thu, 14 Apr 2016 13:07:03 +0100, blindanag...@nowhere.net declaimed the
> following:
>
>> On 14/04/2016 09:13, blindanag...@nowhere.net wrote:
>>> On 14/04/2016 08:59, blindanag...@nowhere.net wrote:
On 14/04/2016 07:52, ast wrote:
>>>
T
Am 15.04.16 um 02:36 schrieb Dennis Lee Bieber:
I should also have said that the square root of integer squares with
between 15 and 30 decimal digits will only be correct if the square
numbers themselves are exactly representable in 53 bits. So we can
expect failures for squares with 16 or more
On 14/04/2016 09:13, blindanag...@nowhere.net wrote:
> On 14/04/2016 08:59, blindanag...@nowhere.net wrote:
>> On 14/04/2016 07:52, ast wrote:
>
>> This means that the result will be correct provided it has 53 or less
>> bits - just short of 16 decimal digits (i.e for square numbers with less
>> t
On 14/04/2016 08:59, blindanag...@nowhere.net wrote:
> On 14/04/2016 07:52, ast wrote:
> This means that the result will be correct provided it has 53 or less
> bits - just short of 16 decimal digits (i.e for square numbers with less
> than 32 digits).
>
> With an integer square root function (is
On 14/04/2016 07:52, ast wrote:
>
> a écrit dans le message de
> news:52f7516c-8601-4252-ab16-bc30c59c8...@googlegroups.com...
>> Hi,
>>
>> there may be a serious error in python's int() function:
>>
>> print int(float(2.8/0.1))
>>
>> yields
>>
>> 27
>>
>> instead of 28!!
>>
>> I am using Python
ast wrote:
>
> a écrit dans le message de
> news:52f7516c-8601-4252-ab16-bc30c59c8...@googlegroups.com...
>> Hi,
>>
>> there may be a serious error in python's int() function:
>>
>> print int(float(2.8/0.1))
>>
>> yields
>>
>> 27
>>
>> instead of 28!!
>>
>> I am using Python Python 2.7.6, GCC 4.
Am 14.04.16 um 08:52 schrieb ast:
Is it sure that the square root of a square number is always
an integer ?
Mathematically, yes.
I would not like to get a result as 345.
from math import sqrt
sqrt(16)
4.0
sqrt(16).is_integer()
True
for n in range(100):
... if not
a écrit dans le message de
news:52f7516c-8601-4252-ab16-bc30c59c8...@googlegroups.com...
Hi,
there may be a serious error in python's int() function:
print int(float(2.8/0.1))
yields
27
instead of 28!!
I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
Is that known?
Best,
Marti
martin.spic...@gmail.com wrote:
print int(float(2.8/0.1))
yields
27
instead of 28!!
This is a consequence of the fact that the machine does
floating point arithmetic in binary, not decimal.
0.1 is not exactly representable as a binary floating
point number, and the result of the division co
On 13/04/2016 08:41, martin.spic...@gmail.com wrote:
> Hi,
>
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
>
> I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
>
> Is that known?
This arises because f
martin.spic...@gmail.com writes:
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
That's how floating-point arithmetic works: look at the result of
2.8/0.1 to see why int() is correct.
> Is that known?
Yes, it is known, and correct since you use "float". See
http://floating-poi
martin.spic...@gmail.com wrote:
> Hi,
>
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
>
> I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
>
> Is that known?
Yes. C has the same error as has every ot
martin.spic...@gmail.com:
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
It is not an error but a normal artifact of decimal-to-binary
conversion.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
there may be a serious error in python's int() function:
print int(float(2.8/0.1))
yields
27
instead of 28!!
I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
Is that known?
Best,
Martin
--
https://mail.python.org/mailman/listinfo/python-list
16 matches
Mail list logo