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

 
 

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

Submitted by:  Andy Hutchinson <hutchinsonandy>
Submitted on:  Sun 22 Jun 2008 09:51:37 PM UTC  
 
Category: Feature RequestSeverity: 1 - Wish
Priority: 3 - LowItem Group: libm code
Status: FixedPercent Complete: 100%
Assigned to: Dmitry Xmelkov <dmix>Open/Closed: Closed
Release: AnyFixed Release: 1.6.4

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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

Added cbrt() function.

Dmitry Xmelkov <dmix>
Project AdministratorIn charge of this item.
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>
Project 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.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 24 May 2009 09:36:39 PM UTCdmixStatusIn Progress=>Fixed
      Percent Complete90%=>100%
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>1.6.4
    Sun 17 May 2009 04:18:49 AM UTCdmixItem Grouplibc code=>libm code
      StatusNone=>In Progress
      Percent Complete50%=>90%
      Assigned toNone=>dmix
    Mon 11 Aug 2008 02:49:29 AM UTCarcanumSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>3 - Low
    Fri 01 Aug 2008 10:06:42 PM UTCarcanumPercent Complete0%=>50%

    Back to the top


    Powered by Savane 3.1-cleanup1