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

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

Re: [avr-libc-dev] fmod() accuracy


From: Eric Weddington
Subject: Re: [avr-libc-dev] fmod() accuracy
Date: Tue, 17 Jan 2006 15:54:32 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Dmitry K. wrote:
Hi.

The fmod() function is not absolutely accurate.
For example:
   fmod (1000001, 1000000) --> 9.536743e-01
   fmod (1000001, 10)      --> 1.015625e+00
The reason is too simple algorithm with float point
arithmetic usage.

fmod() is an important function. It is used in
trigonometric: sin/cos/tan .

After replacement of algorithm (to integral division)
the fmod() became absolutely exact. Speed is up
considarable. Size is increased a little (but the stack
usage is reduced).
Testing in progress...

Fantastic!

I'd rather take an accurate function over a slight increase in size any day.

--
Eric Weddington




reply via email to

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