postcss / postcss-calc

PostCSS plugin to reduce calc()
MIT License
213 stars 34 forks source link

Precision for nested calc is not accurate #66

Closed andreymal closed 5 years ago

andreymal commented 5 years ago
.foo {
  width: calc(100% / 3 * 3);
  height: calc(calc(100% / 3) * 3);
}

Expected output:

.foo {
  width: 100%;
  height: 100%;
}

Actual output:

.foo {
  width: 100%;
  height: 99.99999%;
}

reduce-css-calc is also affected

Note that it works in Firefox and Chrome:

Semigradsky commented 5 years ago

@andreymal Just increase precision parameter: https://github.com/postcss/postcss-calc#precision-default-5

andreymal commented 5 years ago

@Semigradsky no, I want precision=5 with correct rounding