File: xmath.h

package info (click to toggle)
craft 3.5-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,996 kB
  • ctags: 1,585
  • sloc: cpp: 3,793; makefile: 2,310; ansic: 839; sh: 385
file content (61 lines) | stat: -rw-r--r-- 2,286 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*======================================================================*/
/*= CHANGES AND UPDATES                                                =*/
/*======================================================================*/
/*= date   person file       subject                                   =*/
/*=--------------------------------------------------------------------=*/
/*=                                                                    =*/
/*= 170293 hua    xmath.h    added i_abs                               =*/
/*=                                                                    =*/
/*======================================================================*/

#ifndef xmath_h
#define xmath_h

/*-------------------------------------------------------------------------*/
/* xmath.inc                                                               */
/*                                                                         */
/*                                                                         */
/*                                                                         */
/*-------------------------------------------------------------------------*/

#include "stdlib.h"
#include "math.h"
#include "bool.h"

bool b_on    (int bits, int bno);
int  b_set   (int current, int bno);
int  b_reset (int current, int bno);

int i_abs    (int a);
int i_sign   (int a);
int i_min    (int a, int b); 
int i_max    (int a, int b);
int i_mean   (int a, int b);
int i_random (int lower_bound, int upper_bound);
int i_bound  (int min, int i, int max);

double d_min       (double a, double b);
double d_max       (double a, double b);
double d_bound     (double min, double v, double max);
double d_abs       (double a);
double d_sign      (double a);
double d_round     (double d, int s);

float  f_min       (float a, float b);
float  f_max       (float a, float b);

double g_sin       (double x);
double g_cos       (double x);
double g_arc_sin   (double x);
double g_arc_cos   (double x);
double g_arc_tan2  (double dx, double dy);
double g_norm      (double a);
double g_diff      (double a1, double a2);

double d_random    (double lower_bound, double upper_bound);
void   d_randomize (int d);

int    hextoint    (char hex []);
char  *inttohex    (int  i);

#endif