Skip to content

Commit

Permalink
Fix for better comparison to zero with extremely small values (<0.000…
Browse files Browse the repository at this point in the history
…00001)
  • Loading branch information
fortier committed Sep 14, 2009
1 parent 18a21c9 commit 8664a2b
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 92 deletions.
2 changes: 2 additions & 0 deletions ta-lib/CHANGELOG.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ New Features
- VS2005 makefile for SWIG Python interface.
- MacOS makefile for SWIG Perl interface.
- Visual Studio 2008 support
- General fix to floating point processing for support
of calculation with very small values (<0.00000001).

Fixes
=====
Expand Down
5 changes: 3 additions & 2 deletions ta-lib/c/src/ta_func/ta_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,10 @@ void TA_S_INT_stddev_using_precalc_ma( const float *inReal,
* must be carefully choosen to work in the domain of the tested values.
* Do a search on Google for a more generalize algo.
*/
#define TA_EPSILON (0.00000000000001)
#define TA_REAL_EQ(x,v,ep) (((v-ep)<x)&&(x<(v+ep)))
#define TA_IS_ZERO(v) (((-0.00000001)<v)&&(v<0.00000001))
#define TA_IS_ZERO_OR_NEG(v) (v<0.00000001)
#define TA_IS_ZERO(v) (((-TA_EPSILON)<v)&&(v<TA_EPSILON))
#define TA_IS_ZERO_OR_NEG(v) (v<TA_EPSILON)

/* The following macros are being used to do
* the Hilbert Transform logic as documented
Expand Down
Loading

0 comments on commit 8664a2b

Please sign in to comment.