<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Moreover:</p>
    <p>var
      <br>
        c: currency;
      <br>
        i1: int64;
      <br>
        i2: int64 absolute c;
      <br>
      <br>
      begin
      <br>
        c := 68719476736;
      <br>
        i1 := Trunc(c*10000);
      <br>
        writeln(c,', ',i1,', ',i2);
      <br>
        readln;
      <br>
      end.
      <br>
      <br>
      Win32 (as expected):  6.871947673600000000E+10, 687194767360000,
      687194767360000
      <br>
      Win64 (wrong)          :  6.871947673600000000E+10,
      53550614319         , 687194767360000
      <br>
    </p>
    <div class="moz-cite-prefix">L.<br>
      <br>
    </div>
    <blockquote type="cite"
      cite="mid:a153f8bc-21b5-a80f-2024-64c441dd1f1a@zoznam.sk">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <p>Than you,<br>
      </p>
      <blockquote type="cite"
        cite="mid:20180518121642.5A894DFF@atlas.cz">
        <p style="padding:0 0 0 0; margin:0 0 0 0;"><br>
        </p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;">I have</p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;">unit1.pas:36       
                                i:=Int64(c);</p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;">000000000046EEE0
          488b45e8                 mov    -0x18(%rbp),%rax</p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;">000000000046EEE4
          488945e0                 mov    %rax,-0x20(%rbp)</p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;">unit1.pas:38       
                                writeln(i);</p>
        <div>at Level0 and</div>
        <div>
          <div>unit1.pas:36                              i:=Int64(c);</div>
          <div>000000000046EECD 4c8b2424                 mov   
            (%rsp),%r12</div>
          <div>unit1.pas:38                              writeln(i);</div>
        </div>
        <div>at Level3.</div>
      </blockquote>
      So we can clearly say, that x64_86 output is different on Linux
      and Windows64<br>
      It is at least strange from my POV because I would expect
      consistent results across platforms.<br>
      <br>
      <blockquote type="cite"
        cite="mid:20180518121642.5A894DFF@atlas.cz">
        <div>I just noticed that you wrote you are expecting 1000. You
          should expect 10000 since currency has four decimals.</div>
      </blockquote>
      Yes, it was typo. Of course I expect 10000<br>
      <br>
      L.<br>
      <br>
      <blockquote type="cite"
        cite="mid:20180518121642.5A894DFF@atlas.cz">
        <div>V. </div>
        <p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
        <p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br>
          > Od: LacaK <a class="moz-txt-link-rfc2396E"
            href="mailto:lacak@zoznam.sk" moz-do-not-send="true"><lacak@zoznam.sk></a><br>
          > Komu: <a class="moz-txt-link-abbreviated"
            href="mailto:fpc-pascal@lists.freepascal.org"
            moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a><br>
          > Datum: 18.05.2018 07:54<br>
          > Předmět: Re: [fpc-pascal] Currency and Int64 casting<br>
          ></p>
        <br>
        <blockquote cite="mid:20180517172024.7601650B@atlas.cz">
          <p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
          <p style="padding: 0 0 0 0; margin: 0 0 0 0;">Linux
            64-bit Lazarus 1.9.0 r57948M FPC 3.1.1 x86_64-linux-qt gives</p>
          <p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
          <p style="padding: 0 0 0 0; margin: 0 0 0 0;"> 1.000000000000000000E+00
            10000</p>
        </blockquote>
        What is dissassembly for:<br>
          i:=Int64(c);?<br>
        <br>
        I have for Win32:<br>
        test_curr_int64.lpr:19            i1 := Int64(c);<br>
        0040158D a100c04200               mov    0x42c000,%eax<br>
        00401592 a310c04200               mov    %eax,0x42c010<br>
        00401597 a104c04200               mov    0x42c004,%eax<br>
        0040159C a314c04200               mov    %eax,0x42c014<br>
        <br>
        and for Win64:<br>
        test_curr_int64.lpr:19                    i1 := Int64(c);<br>
        00000001000015BD 488b0d3caa0300           mov   
        0x3aa3c(%rip),%rcx        # 0x10003c000<br>
        00000001000015C4 48b84b598638d6c56d34     movabs
        $0x346dc5d63886594b,%rax<br>
        00000001000015CE 48f7e9                   imul   %rcx<br>
        00000001000015D1 48c1fa0b                 sar    $0xb,%rdx<br>
        00000001000015D5 48c1e93f                 shr    $0x3f,%rcx<br>
        00000001000015D9 4801ca                   add    %rcx,%rdx<br>
        00000001000015DC 4889152daa0300           mov   
        %rdx,0x3aa2d(%rip)        # 0x10003c010<br>
        <br>
        <br>
        L.<br>
        <blockquote cite="mid:20180517172024.7601650B@atlas.cz">
          <p style="padding: 0 0 0 0; margin: 0 0 0 0;">______________________________________________________________<br>
            > Od: LacaK <a href="mailto:lacak@zoznam.sk"
              moz-do-not-send="true"><lacak@zoznam.sk></a><br>
            > Komu: FPC-Pascal users discussions <a
              href="mailto:fpc-pascal@lists.freepascal.org"
              moz-do-not-send="true"><fpc-pascal@lists.freepascal.org></a><br>
            > Datum: 17.05.2018 13:33<br>
            > Předmět: [fpc-pascal] Currency and Int64 casting<br>
            ></p>
          Hi,<br>
          <br>
          consider following program:<br>
          <br>
          var<br>
            c: currency;<br>
          <br>
          begin<br>
            c := 1;<br>
            writeln(c,' ',Int64(c));<br>
            readln;<br>
          end.<br>
          <br>
          FPC 3.0.4<br>
          On Win32/x86 I get: 1, 1000  (what I am expecting)<br>
          On Win64/x86_64 I get: 1, 1<br>
          <br>
          Is is as expected ?<br>
          <br>
          Is there safe way for both platforms how to get 1000 (beside
          that I can <br>
          use: i: int64 absolute c;)<br>
          <br>
          Thanks<br>
          <br>
          -Laco.<br>
          <br>
          _______________________________________________<br>
          fpc-pascal maillist  -  <a
            href="mailto:fpc-pascal@lists.freepascal.org"
            moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a><br>
          <a
            href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal"
            moz-do-not-send="true">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre>_______________________________________________
fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org" moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" moz-do-not-send="true">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
        </blockquote>
        <br>
        <br>
        <br>
        ----------<br>
        <br>
        _______________________________________________<br>
        fpc-pascal maillist  -  <a class="moz-txt-link-abbreviated"
          href="mailto:fpc-pascal@lists.freepascal.org"
          moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a><br>
        <a
          href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal"
          moz-do-not-send="true">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
fpc-pascal maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org" moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" moz-do-not-send="true">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fpc-pascal maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
    </blockquote>
    <br>
  </body>
</html>