Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Written by J.T. Conklin <jtc@netbsd.org>.
  3.  * Public domain.
  4.  * Removed header file dependency for use in libmingwex.a by
  5.  *   Danny Smith <dannysmith@users.sourceforge.net>
  6.  */
  7.  
  8.         .file   "log1p.S"
  9.         .text
  10.         .align 4
  11.         /* The fyl2xp1 can only be used for values in
  12.            -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
  13.            0.29 is a safe value.
  14.          */
  15. limit:  .double 0.29
  16. one:    .double 1.0
  17. /*
  18.  * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
  19.  * otherwise fyl2x with the needed extra computation.
  20.  */
  21. .globl _log1p;
  22.         .def    _log1p; .scl    2;      .type   32;     .endef
  23. _log1p:
  24.         fldln2
  25.         fldl    4(%esp)
  26.         fxam
  27.         fnstsw
  28.         fld     %st
  29.         sahf
  30.         jc      3f      /* in case x is NaN or ±Inf */
  31.  
  32. 4:      fabs
  33.         fcompl  limit
  34.         fnstsw
  35.         sahf
  36.         jc      2f
  37.         faddl   one
  38.         fyl2x
  39.         ret
  40.  
  41. 2:      fyl2xp1
  42.         ret
  43.  
  44. 3:      jp      4b      /* in case x is ±Inf */
  45.         fstp    %st(1)
  46.         fstp    %st(1)
  47.         ret
  48.