HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
math_ops.h File Reference

Contains macros for common mathematical functions. More...

#include <math.h>

Go to the source code of this file.

Macros

#define min(a, b)   ((a)<(b)?(a):(b))
 
#define max(a, b)   ((a)>(b)?(a):(b))
 
#define min3(a, b, c)   min(min((a),(b)),min((b),(c)))
 
#define max3(a, b, c)   max(max((a),(b)),max((b),(c)))
 
#define absolute(a)   ((a)<0?-(a):(a))
 
#define raiseto(x, a)   (exp((a)*log(x)))
 
#define raiseto_int(y, x, a)
 
#define sign(a)   ((a)<0?-1.0:1.0)
 

Detailed Description

Contains macros for common mathematical functions.

Author
Debojyoti Ghosh

Definition in file math_ops.h.

Macro Definition Documentation

◆ min

#define min (   a,
 
)    ((a)<(b)?(a):(b))

Minimum of two numbers

Definition at line 14 of file math_ops.h.

◆ max

#define max (   a,
 
)    ((a)>(b)?(a):(b))

Maximum of two numbers

Definition at line 18 of file math_ops.h.

◆ min3

#define min3 (   a,
  b,
 
)    min(min((a),(b)),min((b),(c)))

Minimum of three numbers

Definition at line 23 of file math_ops.h.

◆ max3

#define max3 (   a,
  b,
 
)    max(max((a),(b)),max((b),(c)))

Maximum of three numbers

Definition at line 27 of file math_ops.h.

◆ absolute

#define absolute (   a)    ((a)<0?-(a):(a))

Absolute value

Definition at line 32 of file math_ops.h.

◆ raiseto

#define raiseto (   x,
 
)    (exp((a)*log(x)))

Raise to a power: y = x^a

Definition at line 37 of file math_ops.h.

◆ raiseto_int

#define raiseto_int (   y,
  x,
 
)
Value:
{ \
int arraycounter; \
y = x; \
for (arraycounter=1; arraycounter<a; arraycounter++) { \
y *= x; \
} \
}

Raise to a power (int only): y = x^a

Definition at line 42 of file math_ops.h.

◆ sign

#define sign (   a)    ((a)<0?-1.0:1.0)

Returns the sign of the argument

Definition at line 54 of file math_ops.h.