Subversion Repositories Kolibri OS

Rev

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

  1. /* sf_log2.c -- float version of s_log2.c.
  2.  * Modification of sf_exp10.c by Yaakov Selkowitz 2009.
  3.  */
  4.  
  5. /*
  6.  * ====================================================
  7.  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  8.  *
  9.  * Developed at SunPro, a Sun Microsystems, Inc. business.
  10.  * Permission to use, copy, modify, and distribute this
  11.  * software is freely granted, provided that this notice
  12.  * is preserved.
  13.  * ====================================================
  14.  */
  15.  
  16. /*
  17.  * wrapper log2f(x)
  18.  */
  19.  
  20. #include "fdlibm.h"
  21. #include <errno.h>
  22. #include <math.h>
  23. #undef log2
  24. #undef log2f
  25.  
  26. #ifdef __STDC__
  27.         float log2f(float x)            /* wrapper log2f */
  28. #else
  29.         float log2f(x)                  /* wrapper log2f */
  30.         float x;
  31. #endif
  32. {
  33.   return (logf(x) / (float_t) M_LN2);
  34. }
  35.  
  36. #ifdef _DOUBLE_IS_32BITS
  37.  
  38. #ifdef __STDC__
  39.         double log2(double x)
  40. #else
  41.         double log2(x)
  42.         double x;
  43. #endif
  44. {
  45.         return (double) log2f((float) x);
  46. }
  47.  
  48. #endif /* defined(_DOUBLE_IS_32BITS) */
  49.