avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #14852] fp pow function broken for negative x


From: anonymous
Subject: [avr-libc-dev] [bug #14852] fp pow function broken for negative x
Date: Mon, 24 Oct 2005 21:36:06 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7

URL:
  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=14852>

                 Summary: fp pow function broken for negative x
                 Project: AVR C Runtime Library
            Submitted by: None
            Submitted on: Mon 10/24/05 at 21:36
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
        Percent Complete: 0%
        Originator Email: address@hidden
             Open/Closed: Open

    _______________________________________________________

Details:

I believe the implementation of pow is inconsistent with the standard POSIX
definition. The one provided by avr libc assumes x>0 so that it can
approximate x^y with exp( log(x) * y).

The POSIX definition allows x<0, provided that y is integral valued.

In my case, I was computing a euclidean distance ((x1-x0)^2 + (y1-y0)^2),
using pow for no good reason, but it crashed the atmel with an apparant stack
overflow. (Presumably log(x) is ill-behaved for x<0).

x<0 could be relatively easily handled with a little wrapper which computes
pow (abs(x), y) * (-1 if y is odd). 



    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
eolson --AT-- mit --DOT-- edu       | Originator Email




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=14852>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]