- /* sdflnxmd.cpp by K.Tsuru */
- // function ID 3408 DRADIX since ver. 2.30
- /*--------------------------------------------------------------------------
- Get a calculation method for log(x) functions.
- x = X * 10^exp
- log(x) = log(X)+exp*log(10), add = exp*log(10)
- It returns true if x = 1 or 10, set X = 0 or log(10).
- ----------------------------------------------------------------------------*/
- #ifndef SN_H
- #include "sn.h"
- #endif
- static const SDouble TEN(10.0);
- static const char* const func = "Log(x)";
- bool GetLogxCalcMethod(const SDouble& x, SDouble& X, SDouble& add){ //3406
- if(x.Sign(3408) <= 0) x.SetError(x.DOMAIN_ERR, func, 3408); // x <= 0
- if(x.IsOne()) {
- X.SetZero(); return true; // x = 1.0
- }
- if(x == TEN) {
- X = Log10(); return true; // x = 10
- }
- // Convert into x = X * 10^exp where 0< X < 1.0
- long exp; // exponent
- X = SDtoE_Form(x, &exp);
- // log(x) = log(X)+exp*log(10), add = exp*log(10)
- if(exp != 0) add = exp * Log10(); // It must pass through this statement for x = 10.
- else add.SetZero();
-
- return false;
- }
sdflnxmd.cpp : last modifiled at 2016/04/04 10:38:56(1,073 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).