[Qt-interest] Why 1/255 is 0 ?

Hannu Shemeikka hps at shemeikka.org
Wed Oct 13 16:11:11 CEST 2010


Hi,

Could someone explain me this:

double c = 1/255; 

and c is 0 after watching it in debugger. It should be 0,003921569.
I tried float and few others but no success.

The real thing where I need that division is qPow((i/255),(j/1)); //
i<255 and j<8

What am I missing here? I'm using Ubuntu 10.10 and Qt 4.7

- Hannu




More information about the Qt-interest-old mailing list