32 bit images * -1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

32 bit images * -1

Gabriel Landini
If I multiply a 32 bit image by -1, the values that were originally 0 are
returned as -0 with the macro function getPixel() e.g.:

print (getPixel(3,0));

Is that a bug?

Regards
Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: 32 bit images * -1

Stephan Saalfeld
No---that's IEEE 754.  There is a positive and a negative 0.

Best,
Stephan


On Fri, 2010-05-07 at 12:08 +0100, Gabriel Landini wrote:
> If I multiply a 32 bit image by -1, the values that were originally 0 are
> returned as -0 with the macro function getPixel() e.g.:
>
> print (getPixel(3,0));
>
> Is that a bug?
>
> Regards
> Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: 32 bit images * -1

dscho
In reply to this post by Gabriel Landini
Hi,

On Fri, 7 May 2010, Gabriel Landini wrote:

> If I multiply a 32 bit image by -1, the values that were originally 0 are
> returned as -0 with the macro function getPixel() e.g.:
>
> print (getPixel(3,0));

This is the so-called "signed zero"
(http://en.wikipedia.org/wiki/Signed_zero) that is a side-effect of the
way floating point numbers are stored in Java.

Ciao,
Dscho