title: Same calculation on Linux and Windows --> different results
body: <p>I have coded following algorithm to convert a decimal value into Binary/Hexadecimal etc..</p>
  
  <pre><code>string toFormatFromDecimal(long long t, Format format) {
      int digitCount = ceil(log(t) / log((int) format));
      string hex = "";
      for (int i = 0; i &lt; digitCount; i++) {
          long double cur = (long double)t / (long double)(format);
          long long ganzzahl = (long long) cur;
          long double kommazahl = cur - ganzzahl;
          hex += digits[(long long) (kommazahl * format)];
          t = ganzzahl;
      }
      return string(hex.rbegin(), hex.rend());
  }
  </code></pre>
  
  <p>I use GCC in linux and Visual Studio c++ compiler on Windows
  It seems that i got different values at the "integer" Division here:</p>
  
  <pre><code>long long ganzzahl = (long long) cur;
  </code></pre>
  
  <p>Any Idea how this could happen? are there different precissions on Linux and Windows?</p>
  
  <p>Thanks
  Florian</p>
  
  <p>--Solution--</p>
  
  <pre><code>string toFormatFromDecimal(long long t, Format format) {
      int digitCount = ceil(log(t) / log((int) format));
      string hex = "";
      for (int i = 0; i &lt; digitCount; i++) {
          hex += digits[(int) (t%format)];
          t = t/format;
      }
      return string(hex.rbegin(), hex.rend());
  }
  </code></pre>