[Top][All Lists]

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

[avr-libc-dev] fmod() accuracy

From: Dmitry K.
Subject: [avr-libc-dev] fmod() accuracy
Date: Wed, 18 Jan 2006 08:47:38 +1000
User-agent: KMail/1.5


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...


P.S. Certainly, processing of all features of the
IEEE 754 standard is added.

reply via email to

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