Subversion Repositories Kolibri OS

Rev

Rev 4973 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
  2. #include<libc/asm.h>
  3.  
  4. NaN:
  5.         .long     0x00000000, 0xFFF80000
  6.  
  7. MK_C_SYM(sincos)
  8.  
  9.         /* void sincos(double x, double *sine, double *cosine); */
  10.  
  11.         movl    8(%esp), %ecx
  12.  
  13.         movl    16(%esp), %eax          /* Point to cosine. */
  14.         movl    12(%esp), %edx          /* Point to sine. */
  15.  
  16.         andl    $0x7FF00000, %ecx       /* Examine exponent of x. */
  17.         cmpl    $0x43E00000, %ecx       /* |x| >= 2^63 */
  18.         jae     bigarg
  19.  
  20.         fldl    4(%esp)
  21.         fsincos
  22.         fstpl   (%eax)                  /* cos */
  23.         fstpl   (%edx)                  /* sin */
  24.         ret
  25.  
  26. bigarg:
  27.         cmpl    $0x7FF00000, %ecx       /* x is INF or NaN. */
  28.         jb      finite
  29.         movl    NaN, %ecx               /* Return -NaN */
  30.         movl    %ecx, (%eax)
  31.         movl    %ecx, (%edx)
  32.         movl    NaN+4, %ecx
  33.         movl    %ecx, 4(%eax)
  34.         movl    %ecx, 4(%edx)
  35.         movl    $1, C_SYM(errno)
  36.         ret
  37.  
  38. finite:
  39.         fld1
  40.         fstpl   (%eax)                  /* cos = 1. */
  41.         fldz
  42.         fstpl   (%edx)                  /* sin = 0. */
  43.         ret    
  44.