bugAVR C Runtime Library - Bugs: bug #23677, Request for cbrt() and strdup to...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #23677: Request for cbrt() and strdup to be added to libc

Submitter:  Andy Hutchinson <hutchinsonandy>
Submitted:  Sun 22 Jun 2008 09:51:37 PM UTC
   
 
Category:  Feature Request Severity:  1 - Wish
Priority:  3 - Low Item Group:  libm code
Status:  Fixed Assigned to:  dmix
Percent Complete:  100% Open/Closed:  Closed
Release:  Any Fixed Release:  1.6.4

Sun 24 May 2009 09:36:39 PM UTC, comment #2: 

Added cbrt() function.

Dmitry Xmelkov <dmix>
Group administrator
Fri 01 Aug 2008 10:06:42 PM UTC, comment #1: 

Added strdup() function. This fixes the GCC test case gcc.dg/alias-11.c.

Eric Weddington <arcanum>
Group administrator
Sun 22 Jun 2008 09:51:37 PM UTC, original submission:  

It seems gcc testsuite assumes presence of widely available strdup() and cbrt() functions.

strdup is a derivative of malloc
cbrt is cubic root x^(1/3)

Here are some generic version that can be used as starter.
I'm sure someone can trim them up a bit - or even convert to asm.

Best version depends on how we built existing maths  functions.

double cbrt(const double x)

{
return pow(x,1.0/3.0);
}

OR

double cbrt(const double xx)
{
   double x= xx;
   if  (x==0.0) /* log will fail, but answer is easy */
      return 0.0;
   else if  (x>0.0)
       return(exp(log(x)/3.0));
   else
   x= -x;
      return(exp(log(x)/3.0));
  }



char *  strdup( const char *str)
{
       unsigned int len;
       char *copy;
       len = strlen(str) + 1;
       copy = malloc(len);
       if (!copy)
               return (copy);
       memcpy(copy, str, len);
       return (copy);
}
Andy

Andy Hutchinson <hutchinsonandy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dmix (Updated the item)
  • -email is unavailable- added by arcanum (Posted a comment)
  • -email is unavailable- added by hutchinsonandy (Submitted the item)
  •  

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-05-24 dmix StatusIn Progress Fixed
        Percent Complete90% 100%
        Open/ClosedOpen Closed
        Fixed ReleaseNone 1.6.4
    2009-05-17 dmix Item Grouplibc code libm code
        StatusNone In Progress
        Percent Complete50% 90%
        Assigned toNone dmix
    2008-08-11 arcanum Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
    2008-08-01 arcanum Percent Complete0% 50%

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code