[Qt-interest] Why 1/255 is 0 ?
Thiago Macieira
thiago at kde.org
Wed Oct 13 16:27:30 CEST 2010
On Wednesday 13. October 2010 16.15.27 Reece Dunn wrote:
> On 13 October 2010 15:11, Hannu Shemeikka <hps at shemeikka.org> wrote:
> > Hi,
> >
> > Could someone explain me this:
> >
> > double c = 1/255;
>
> That is an integer division that is rounded to the nearest whole integer.
>
> Try:
>
> double c = double(1)/255;
Also:
double c = 1.0 / 255;
double c = 1 / 255.0;
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101013/96157251/attachment.bin
More information about the Qt-interest-old
mailing list