← Back to team overview

phatch-dev team mailing list archive

[Bug 384420] Re: Inaccurate opacity floating point calculations

 

** Changed in: phatch
       Status: Fix Committed => Fix Released

** Changed in: phatch
    Milestone: None => 0.2.1

-- 
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!: Fix Released

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



References