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:
@@ -4112,10 +4112,10 @@ define test_error()
|
||||
n = 8191;
|
||||
print '3727: n = 8191';
|
||||
/* test 3728 removed due to non-portable strerror() output */
|
||||
vrfy(tan(2e9i) == error(10435), '3729: tan(2e9i) == error(10435)');
|
||||
vrfy(cot(2e9i) == error(10437), '3730: cot(2e9i) == error(10437)');
|
||||
vrfy(sec(2e9i) == error(10439), '3731: sec(2e9i) == error(10439)');
|
||||
vrfy(csc(2e9i) == error(10440), '3732: csc(2e9i) == error(10440)');
|
||||
vrfy(tan(2e9i) == error(10537), '3729: tan(2e9i) == error(10537)');
|
||||
vrfy(cot(2e9i) == error(10539), '3730: cot(2e9i) == error(10539)');
|
||||
vrfy(sec(2e9i) == error(10540), '3731: sec(2e9i) == error(10540)');
|
||||
vrfy(csc(2e9i) == error(10542), '3732: csc(2e9i) == error(10542)');
|
||||
|
||||
/* errmax and errcount should be bumped up the 148 errors above */
|
||||
vrfy(errcount() == ecnt, '3733: errcount() == ecnt');
|
||||
|
Reference in New Issue
Block a user