First: this issue has nothing to do with the Sass::Script::Number.Precision. That is fine!
The past three hours I was going nuts seeing Sass (Scout 0.7.1, Win 7 x64) calculating the same math operation with two different outcomes between two compilings. It’s insane!
I simply tried to convert centimeters to inches by doing:
$in: $cm / 2.54;
After saving (compiling), the outcome was: 0.3937, as one would expect.
After saving again, however the outcome was: 0.5. My boy, my boy!
And so Sass seems to choose the result at random, at every saving (compiling); but most of the time the wrong result as far as I could see.
It took me tree hours to narrow the problem down inside of my mixins.
What is going on now is pretty clear to see in my minified examples: sometimes Sass forgets, that there are some numbers present behind the decimal point. It calculates 1 / 2 = 0.5.
I wonder that so few people have this problem – am I the only one who noticed this?
It was hard to google for this.
I only found some related problems, also concerning floting points (maybe theres the same underlying problem):
So far by the comments it seems to be narrowed down to that it is no promlem with Compass or Scout, it must be Sass itself. Please fix this quick!
For the moment I found out that to abstain from typing floating points will solve this problem! Like so:
$factor: $factor / 100;
$in: $cm / $factor;
Luckily at least this is possible. Or shorter:
$in: $cm / 254 / 100;
So when a floating point occurs via "hidden calculation" inside of variables, this problem seems not to happen – so no one needs to be scared. Only when typed directly, then this weired loss of decimals occurs.
And notice whats also a problem:
$in: $cm / $factor;
Almost all the time.
It seams that the first time Sass gets it right, all the other times Sass cancels the decimals.
Btw: this also occurs when multiplying, oder adding, or subtracting:
$in: 1 + 2.54;
Makes 3. This is just ridiculous.
So: do not type floating point decimals until this is fixed.
This is some pretty crazy behavior. I can't reproduce it locally; what's your operating system version, Ruby version, and Sass version?
Well, as I wrote in my post (just got finished with it pheew!), I run Scout 0.7.1 on Win 7 x64.
I don’t know what Ruby version is in it or whatever – I use Scout because I don’t want to care about that hazzle, you know? ^^ Mabe you can find out by knowing the version the version number of 0.7.1.
Or if you tell me how I can find out about this stuff, I’ll have a look.
To be more precise with Windows, although I believe it has not the slightest thing to do with this problem:
Hope this is of any help.
Some suspect (in my issue-links above) that it could have something to so with using partials.
Not having tested this yet.
EDIT: In the meantime I can confirm: it has nothing to do with partials – this also happens when having just one single main file processed.
Does Scout have an About menu option that tells you more about what versions of stuff it's using? It's not going to be possible to track this down without that.
@Darkwing371 you need to start command prompt with ruby and type sass -v and ruby -v
Nope – Scout is extremly "straight forward" concerning user interface. ^^ No About.
@atomicpages: sorry, but I use Scout – I don’t have what you suggest.
BUT: I looked inside of the Scout directory itself, and what’s inside:
These gems are installed with Scout:
We see I have Sass 3.2.1.
And I have a "jruby-complete.jar", but I don’t know where I could possibly find a file, that tells the version number:
Do one of you?
I can't reproduce this on Sass 3.2.1 on either JRuby 1.7.2 or JRuby 126.96.36.199. It's possible this is specific to Windows, specific to a version of JRuby that @Darkwing371 has but I didn't try, or specific to Scout.
I'm going to guess that the problem is with Scout, since I haven't heard any reports of it happening with Sass alone, I can't reproduce it personally, and it seems to be happening frequently with Scout. As such, I'm closing this issue for now. If someone can reproduce this using Sass alone, I'll re-open.