Expression Calculator
Expressions have C-style syntax, with any number of levels of parenthesis, containing:
- Double precision numbers such as 0.0, 1e7, 123.456, etc.
- Double precision constants PI, E, RTOD=180/PI, DTOR=PI/180, TRUE=1, FALSE=0, NaN, Inf
- Character strings in double quotes
- Unary operators ! (not) and - (minus)
- Binary mathematical operations +, -, *, /, ^ (power)
- Binary logical operations ==, !=, <, >, <=, >=, &&, || (these operations evaluate to TRUE or FALSE
- Trig functions sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(x,y) (arguments in radians)
- Math functions: exp(x), ln(x), log(x), log10(x), sqrt(x), abs(x), int(x)
- String functions cmp(x,y) which compares two strings and substr(x,y) which tests if x is a substring of y. Both
- function return TRUE or FALSE.
- Great circle distance routines: dist(lat1,lon1,lat2,lon2) which takes lat, lon in degrees and returns distance in degrees, and az(lat1,lon1,lat2,lon2) which returns azimuth in degrees.
- IEEE arithmetic function nan(x) and inf(x) which return TRUE if their aguments are NaN or Inf, respectively