lessphp icon indicating copy to clipboard operation
lessphp copied to clipboard

Probably rounding errors

Open sannefoltz opened this issue 13 years ago • 3 comments

Great project, must be difficult, but Is this project still maintained? I dont see any updates in months and Less.js has been updated a few times lately.

Anyway, I got this difference: darken(desaturate(hsl(0,0%,95%),20%),5%)

returns #e5e5e5 in less.js and #e6e6e6 in lessphp

Regards and thanks S

sannefoltz avatar Feb 25 '13 21:02 sannefoltz

"hsl(0,80%,50%)" returns #e61919 in less.js and #e61a1a in lessphp

sannefoltz avatar Feb 25 '13 21:02 sannefoltz

Can also confirm this:

body{
    background-color: darken(#222, 10%);
}

Produces in Less.js: background-color: #080808; And in lessphp: background-color: #090909;

barryvdh avatar Aug 07 '13 08:08 barryvdh

Setting the ini_precision helps, but only for values converted to a string:

// Somewhere
ini_set("precision", "16");

//toHSL
$out = array('hsl',
    round(($H < 0 ? $H + 6 : $H)*60),
    round($S*100),
    round($L*100),
);

This solves my case. Rounding in toRGB also solves the first case mentioned here, but gives other problems. So not really the definitive solution.

barryvdh avatar Aug 09 '13 08:08 barryvdh