phatch-dev team mailing list archive
-
phatch-dev team
-
Mailing list archive
-
Message #00090
[Bug 384420] [NEW] Inaccurate opacity floating point calculations
Public bug reported:
when calculating the opacity, in the reflection and background actions (and possible others) we are using this method:
opacity = int(2.55 * opacity)
if opacity is 100 the result is:
int(2.55 * 100)= int(249.99999999999999) = 244
Which is generating inaccurate results. The correct way of calculating is:
opacity = (255 * opacity) / 100
** Affects: phatch
Importance: Critical
Assignee: Nadia Alramli (nadiana)
Status: New
** Changed in: phatch
Importance: Undecided => Critical
** Changed in: phatch
Assignee: (unassigned) => Nadia Alramli (nadiana)
--
Inaccurate opacity floating point calculations
https://bugs.launchpad.net/bugs/384420
You received this bug notification because you are a member of Phatch
Developers, which is subscribed to Phatch.
Status in Phatch = Photo & Batch!: New
Bug description:
when calculating the opacity, in the reflection and background actions (and possible others) we are using this method:
opacity = int(2.55 * opacity)
if opacity is 100 the result is:
int(2.55 * 100)= int(249.99999999999999) = 244
Which is generating inaccurate results. The correct way of calculating is:
opacity = (255 * opacity) / 100
Follow ups
References