[Vedran Furač]
> I think that this results must be the same:
>
> In [3]: math.atan2(-0.0,-1)
> Out[3]: -3.1415926535897931
Whether -0.0 and 0.0 are different floats internally depends on your
hardware floating-point; on most machines today, they are different
floats, but _compare_ equal to each ot
Serge Orlov wrote:
>> So, you can convert -0 to 0, but you must multiply the result with sign of
>> y, which is '-' (minus).
>
> But you miss the fact that 0 is an *integer*, not a float, and -0
> doesn't exist.
Yes, you are right, I completely missed that 0 is integer in python, and I
need a fl
Vedran Furac wrote:
> Ben Caradoc-Davies wrote:
> > Vedran Furac wrote:
> >> I think that this results must be the same:
> >> In [3]: math.atan2(-0.0,-1)
> >> Out[3]: -3.1415926535897931
> >> In [4]: math.atan2(-0,-1)
> >> Out[4]: 3.1415926535897931
> >
> > -0 is converted to 0, then to 0.0 for cal
Ben Caradoc-Davies wrote:
> Vedran Furač wrote:
>> I think that this results must be the same:
>> In [3]: math.atan2(-0.0,-1)
>> Out[3]: -3.1415926535897931
>> In [4]: math.atan2(-0,-1)
>> Out[4]: 3.1415926535897931
>
> -0 is converted to 0, then to 0.0 for calculation, losing the sign. You
> mig
Vedran Furač wrote:
> I think that this results must be the same:
> In [3]: math.atan2(-0.0,-1)
> Out[3]: -3.1415926535897931
> In [4]: math.atan2(-0,-1)
> Out[4]: 3.1415926535897931
-0 is converted to 0, then to 0.0 for calculation, losing the sign. You
might as well write 0.0 instead of -0
The
Vedran Fura? wrote:
> I think that this results must be the same:
>
> In [3]: math.atan2(-0.0,-1)
> Out[3]: -3.1415926535897931
>
> In [4]: math.atan2(-0,-1)
> Out[4]: 3.1415926535897931
>
> In [5]: -0 == -0.0
> Out[5]: True
Glimpsing at the hardware formats:
>>> struct.pack("d", 0.0)
'\x00\x
I think that this results must be the same:
In [3]: math.atan2(-0.0,-1)
Out[3]: -3.1415926535897931
In [4]: math.atan2(-0,-1)
Out[4]: 3.1415926535897931
In [5]: -0 == -0.0
Out[5]: True
This is python 2.4.4c0 on Debian GNU/Linux.
Regards,
Vedran Furač
--
http://mail.python.org/mailman/lis