|
24 | 24 |
|
25 | 25 | //#include <boost/math/tools/roots.hpp> |
26 | 26 | #include <boost/rational.hpp> |
27 | | -#include <boost/multiprecision/cpp_int.hpp> |
| 27 | +#include <boost/multiprecision/cpp_int.hpp> |
28 | 28 |
|
29 | 29 | namespace BlazesRusCode |
30 | 30 | { |
@@ -3188,130 +3188,7 @@ namespace BlazesRusCode |
3188 | 3188 | } |
3189 | 3189 | } |
3190 | 3190 | return targetValue; |
3191 | | - } |
3192 | | - |
3193 | | - /// <summary> |
3194 | | - /// Natural log of Value(https://en.wikipedia.org/wiki/Natural_logarithm) |
3195 | | - /// Based mostly on https://stackoverflow.com/questions/35968963/trying-to-calculate-logarithm-base-10-without-math-h-really-close-just-having |
3196 | | - /// </summary> |
3197 | | - /// <param name="Value">The value.</param> |
3198 | | - /// <returns></returns> |
3199 | | - static MediumDec Ln(MediumDec Value) |
3200 | | - { |
3201 | | - MediumDec old_sum = Zero; |
3202 | | - MediumDec xmlxpl = (Value - 1) / (Value + 1); |
3203 | | - MediumDec xmlxpl_2 = xmlxpl * xmlxpl; |
3204 | | - int denom = 1; |
3205 | | - MediumDec frac = xmlxpl; |
3206 | | - MediumDec term = frac; |
3207 | | - MediumDec sum = term; |
3208 | | - |
3209 | | - while (sum != old_sum) |
3210 | | - { |
3211 | | - old_sum = sum; |
3212 | | - denom += 2; |
3213 | | - frac *= xmlxpl_2; |
3214 | | - sum += frac / denom; |
3215 | | - } |
3216 | | - return 2 * sum; |
3217 | | - } |
3218 | | - |
3219 | | - /// <summary> |
3220 | | - /// Natural log of Value(https://en.wikipedia.org/wiki/Natural_logarithm) |
3221 | | - /// Based mostly on https://stackoverflow.com/questions/35968963/trying-to-calculate-logarithm-base-10-without-math-h-really-close-just-having |
3222 | | - /// </summary> |
3223 | | - /// <param name="Value">The value.</param> |
3224 | | - /// <returns></returns> |
3225 | | - static MediumDec LnRef(MediumDec& Value) |
3226 | | - { |
3227 | | - MediumDec old_sum = Zero; |
3228 | | - MediumDec xmlxpl = (Value - 1) / (Value + 1); |
3229 | | - MediumDec xmlxpl_2 = xmlxpl * xmlxpl; |
3230 | | - int denom = 1; |
3231 | | - MediumDec frac = xmlxpl; |
3232 | | - MediumDec term = frac; |
3233 | | - MediumDec sum = term; |
3234 | | - |
3235 | | - while (sum != old_sum) |
3236 | | - { |
3237 | | - old_sum = sum; |
3238 | | - denom += 2; |
3239 | | - frac *= xmlxpl_2; |
3240 | | - sum += frac / denom; |
3241 | | - } |
3242 | | - return 2 * sum; |
3243 | | - } |
3244 | | - |
3245 | | - /// <summary> |
3246 | | - /// Natural log of Value(https://en.wikipedia.org/wiki/Natural_logarithm) |
3247 | | - /// Based mostly on https://stackoverflow.com/questions/35968963/trying-to-calculate-logarithm-base-10-without-math-h-really-close-just-having |
3248 | | - /// </summary> |
3249 | | - /// <param name="Value">The value.</param> |
3250 | | - /// <returns></returns> |
3251 | | - static MediumDec Ln(int Value) |
3252 | | - { |
3253 | | - MediumDec old_sum = Zero; |
3254 | | - MediumDec xmlxpl = (Value - 1) / (Value + 1); |
3255 | | - MediumDec xmlxpl_2 = xmlxpl * xmlxpl; |
3256 | | - int denom = 1; |
3257 | | - MediumDec frac = xmlxpl; |
3258 | | - MediumDec term = frac; |
3259 | | - MediumDec sum = term; |
3260 | | - |
3261 | | - while (sum != old_sum) |
3262 | | - { |
3263 | | - old_sum = sum; |
3264 | | - denom += 2; |
3265 | | - frac *= xmlxpl_2; |
3266 | | - sum += frac / denom; |
3267 | | - } |
3268 | | - return 2 * sum; |
3269 | | - } |
3270 | | - |
3271 | | - /// <summary> |
3272 | | - /// Log Base 10 of Value |
3273 | | - /// </summary> |
3274 | | - /// <param name="Value">The value.</param> |
3275 | | - /// <returns>MediumDec</returns> |
3276 | | - static MediumDec Log10(MediumDec Value) |
3277 | | - { |
3278 | | - return Ln(Value) / LN10; |
3279 | | - } |
3280 | | - |
3281 | | - /// <summary> |
3282 | | - /// Log Base 10 of Value |
3283 | | - /// </summary> |
3284 | | - /// <param name="Value">The value.</param> |
3285 | | - /// <returns>MediumDec</returns> |
3286 | | - static MediumDec Log10(int Value) |
3287 | | - { |
3288 | | - return Ln(Value) / LN10; |
3289 | | - } |
3290 | | - |
3291 | | - /// <summary> |
3292 | | - /// Log with Base of BaseVal of Value |
3293 | | - /// Based on http://home.windstream.net/okrebs/page57.html |
3294 | | - /// </summary> |
3295 | | - /// <param name="Value">The value.</param> |
3296 | | - /// <param name="BaseVal">The base of Log</param> |
3297 | | - /// <returns>MediumDec</returns> |
3298 | | - static MediumDec Log(MediumDec Value, MediumDec BaseVal) |
3299 | | - { |
3300 | | - return Log10(Value) / Log10(BaseVal); |
3301 | | - } |
3302 | | - |
3303 | | - /// <summary> |
3304 | | - /// Log with Base of BaseVal of Value |
3305 | | - /// Based on http://home.windstream.net/okrebs/page57.html |
3306 | | - /// </summary> |
3307 | | - /// <param name="Value">The value.</param> |
3308 | | - /// <param name="BaseVal">The base of Log</param> |
3309 | | - /// <returns>MediumDec</returns> |
3310 | | - static MediumDec Log(MediumDec Value, int BaseVal) |
3311 | | - { |
3312 | | - return Log10(Value) / Log10(BaseVal); |
3313 | | - } |
3314 | | - |
| 3191 | + } |
3315 | 3192 |
|
3316 | 3193 | /// <summary> |
3317 | 3194 | /// Perform square root on this instance.(Code other than switch statement from https://www.geeksforgeeks.org/find-square-root-number-upto-given-precision-using-binary-search/) |
|
0 commit comments