title: absolute Value of double
body: <p>I am trying write a function named absD that returns the absolute value of its argument.
  I do not want to use any predefined functions. Right now i am getting a parse error when i try to compile it.</p>
  
  <p>I would image all i would have to do to get the absolute value of a double is change the sign bit? this is what i have</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define PRECISION   3
  
  double absD (double n)
  {
  
  asm("   fld     %eax \n"  
      "   movl    $0x7FFFFFFFFFFFFFFF,  %eax    \n"    
      "   pop     %eax     \n"
  
      );
  
  return n;
  
  
  }
  
  int main (int argc, char **argv)
  {
  double  n = 0.0;
  
  printf("Absolute value\n");
  if (argc &gt; 1)
      n = atof(argv[1]);
  
  printf("abs(%.*f) = %.*f\n", PRECISION, n, PRECISION, absD(n));
  
  return 0;
  }
  </code></pre>
  
  <p>I fixed the curly brace..
  the error i am getting is</p>
  
  <pre><code>~ $ gc a02
  gcc -Wall -g a02.c -o a02
  /tmp/ccl2H7rf.s: Assembler messages:
  /tmp/ccl2H7rf.s:228: Error: suffix or operands invalid for `fld'
  /tmp/ccl2H7rf.s:229: Error: missing or invalid immediate expression `0x7FFFFFFFF
  FFFFFFF'
  ~ $
  </code></pre>