Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly output integers as float is precision is 0 #1153

Closed
xzyfer opened this issue Apr 30, 2015 · 2 comments · Fixed by #1166
Closed

Incorrectly output integers as float is precision is 0 #1153

xzyfer opened this issue Apr 30, 2015 · 2 comments · Fixed by #1166

Comments

@xzyfer
Copy link
Contributor

xzyfer commented Apr 30, 2015

Originally reported in #1140 (comment)

$foo: 123px; 
foo { 
  bar: $foo; }

Libsass with precision 0

foo{
  bar: 123.0px; }

Ruby Sass with precision 0

foo{
  bar: 123px; }
@xzyfer xzyfer self-assigned this Apr 30, 2015
@xzyfer xzyfer added this to the 3.2.2 milestone Apr 30, 2015
@xzyfer xzyfer modified the milestones: 3.2.2, 3.3 May 1, 2015
@mgreter mgreter modified the milestones: 3.2.3, 3.3 May 4, 2015
@mgreter mgreter assigned mgreter and unassigned xzyfer May 4, 2015
@mgreter
Copy link
Contributor

mgreter commented May 4, 2015

Once again, the logix seems to be more complicated then anticipated and again not sure if wanted behavior or just a ruby sass bug? //cc @xzyfer

input.css

foo { 
  bar: (0);
  bar: (.0);
  bar: (0.0);
  bar: (-0);
  bar: (-.0);
  bar: (-0.0);
  bar: (42);
  bar: (-42);
  bar: (43.0);
  bar: (-43.0);
  bar: (44.0000);
  bar: (-44.0000);
  bar: (45.00001);
  bar: (-45.00001);
  bar: (42.84);
  bar: (-42.84);
  bar: (42.24);
  bar: (-42.24);
  bar: (42.845555);
  bar: (-42.845555);
  bar: (42.245555);
  bar: (-42.245555); }

Ruby sass output:

foo {
  bar: 0;
  bar: 0;
  bar: 0;
  bar: 0;
  bar: 0;
  bar: 0;
  bar: 42;
  bar: -42;
  bar: 43;
  bar: -43;
  bar: 44;
  bar: -44;
  bar: 45.0;
  bar: -45.0;
  bar: 43.0;
  bar: -43.0;
  bar: 42.0;
  bar: -42.0;
  bar: 43.0;
  bar: -43.0;
  bar: 42.0;
  bar: -42.0; }

Seems to be a special case if the value was actually rounded. IMO we have a similar expection already in that function, so I might be able to implement it "correctly" ...

@xzyfer
Copy link
Contributor Author

xzyfer commented May 5, 2015

Seems to be a special case if the value was actually rounded

Yes. When I recently refactored this code I applied to "special cases" always because it was semantically equivalent and the old behaviour wasn't.

This issue specifically refers to making the special case only apply to rounded numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants