mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
add cmappr() and missing complex tan, cot, sec, csc in liblcac
Added complex multiple approximation function to commath.c so that users of libcalc may directly round complex number to nearest multiple of a given real number: E_FUNC COMPLEX *cmappr(COMPLEX *c, NUMBER *e, long rnd, bool cfree); For example: COMPLEX *c; /* complex number to round to nearest epsilon */ NUMBER *eps; /* epsilon rounding precision */ COMPLEX *res; /* c rounded to nearest epsilon */ long rnd = 24L; /* a common rounding mode */ bool ok_to_free; /* true ==> free c, false ==> do not free c */ ... res = cmappr(c, eps, ok_to_free); The complex trigonometric functions tan, cot, sec, csc were implemented in func.c as calls to complex sin and complex cos. We added the direct calls to comfunc.c so that users of libcalc may call them directly: E_FUNC COMPLEX *c_tan(COMPLEX *c, NUMBER *eps); E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps); E_FUNC COMPLEX *c_sec(COMPLEX *c, NUMBER *eps); E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);
This commit is contained in:
5
help/cot
5
help/cot
@@ -14,6 +14,10 @@ DESCRIPTION
|
||||
Calculate the cotangent of x to a multiple of eps, with error less
|
||||
in absolute value than .75 * eps.
|
||||
|
||||
This function is equivalent to:
|
||||
|
||||
cot(x) = cos(x) / sin(x)
|
||||
|
||||
EXAMPLE
|
||||
; print cot(1, 1e-5), cot(1, 1e-10), cot(1, 1e-15), cot(1, 1e-20)
|
||||
0.64209 0.6420926159 0.642092615934331 0.64209261593433070301
|
||||
@@ -33,6 +37,7 @@ LIMITS
|
||||
|
||||
LINK LIBRARY
|
||||
NUMBER *qcot(NUMBER *x, NUMBER *eps)
|
||||
COMPLEX *c_cot(COMPLEX *c, NUMBER *eps)
|
||||
|
||||
SEE ALSO
|
||||
sin, cos, tan, sec, csc
|
||||
|
Reference in New Issue
Block a user