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

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

[avr-libc-dev] Pow Function in avr8


From: Thomas, George
Subject: [avr-libc-dev] Pow Function in avr8
Date: Wed, 28 Nov 2012 12:19:02 +0000

The analysis of pow function was done because a change was seen in  the answers 
of

pow (2, exp);
pow (2, 5.0);


where exp is a variable with same value 5.

This looks to be because of the variation in calculation at compile time 
against the calculation done by the pow function in avr-libc.

Looking at the implementation of pow, it looks to be done as exp (power * log 
(base)) for finding base ^ power.

So to know where the change is occurring between native and avr-libc I ran the 
steps one after the other and the results have been attached.

The case.c is the program run.

Looking at the results , it looks like the exponent values are causing the 
change in pow.

Floating point equivalence is not guaranteed so is this comparison valid ?
http://en.wikipedia.org/wiki/Machine_epsilon
The error amount looks to be greater than the epsilon amount mentioned in the 
link.

Is this a bug in implementation of exp () or is this change expected ?

-George-



Attachment: native.res
Description: native.res

Attachment: libc1.8.0.res
Description: libc1.8.0.res

Attachment: case.c
Description: case.c


reply via email to

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