~ubuntu-branches/ubuntu/karmic/kst/karmic

« back to all changes in this revision

Viewing changes to kst/kst/kstmath.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-06-30 19:11:30 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060630191130-acumuar75bz4puty
Tags: 1.2.1-1ubuntu1
Merge from debian unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define KSTMATH_H
22
22
 
23
23
#include <math.h>
 
24
#include <float.h>
 
25
#include <stdlib.h>
 
26
#include <limits.h>
24
27
 
25
28
#ifdef __sun
26
29
#include <ieeefp.h>
27
30
#endif
28
31
 
 
32
#include "kst_export.h"
 
33
 
29
34
/*
30
35
** For systems without NAN, this is a NAN in IEEE double format.
31
36
** Code lifted from kde screensavers.
51
56
** std:: version in those cases.
52
57
*/
53
58
#ifdef isnan
54
 
#define KST_ISNAN(a)    isnan(a)
 
59
#define KST_ISNAN(a)    isnan(a)
55
60
#elif defined(__APPLE__)
56
 
#define KST_ISNAN(a)    (a == NAN ? 1 : 0)
 
61
#define KST_ISNAN(a)    (a == NAN ? 1 : 0)
57
62
#else
58
63
  // HUH? Ok let's get rid of the silliness here sometime.
59
 
#define KST_ISNAN(a)    isnan(a)
60
 
#endif
61
 
 
62
 
#endif
 
64
#define KST_ISNAN(a)    isnan(a)
 
65
#endif
 
66
 
 
67
 
 
68
namespace KST {
 
69
KST_EXPORT extern const double NOPOINT;
 
70
}
 
71
 
 
72
inline int d2i(double x) {
 
73
  return int(floor(x+0.5));
 
74
}
 
75
 
 
76
 
 
77
#if defined(__SVR4) && defined(__sun)
 
78
inline int isinf(double x) { return x == x && !finite(x); }
 
79
#endif
 
80
 
 
81
 
 
82
inline double logX(double x) {
 
83
  return x > 0.0 ? log10(x) : -350.0;
 
84
}
 
85
 
 
86
 
 
87
inline double logY(double y) {
 
88
  return y > 0.0 ? log10(y) : -350.0;
 
89
}
 
90
 
 
91
#endif
 
92
 
63
93
// vim: ts=2 sw=2 et
64
 
 
65