after multiple objections of libtom users [1], we decided to change licensing
[libtomfloat.git] / mpf_const_ln_d.c
blob6ddf4e8e6f6aa51a09e4fd8460736356bd6ae930
1 /* LibTomFloat, multiple-precision floating-point library
3 * LibTomFloat is a library that provides multiple-precision
4 * floating-point artihmetic as well as trigonometric functionality.
6 * This library requires the public domain LibTomMath to be installed.
7 *
8 * This library is free for all purposes without any express
9 * gurantee it works
11 * Tom St Denis, tomstdenis@iahu.ca, http://float.libtomcrypt.org
13 #include <tomfloat.h>
15 int mpf_const_ln_d(mp_float *a, long b)
17 int err;
19 /* test input */
20 if (b < 0) {
21 return MP_VAL;
24 if (b == 0) {
25 return mpf_const_d(a, 1);
28 if (b == 1) {
29 return mpf_const_d(a, 0);
32 if ((err = mpf_const_d(a, b)) != MP_OKAY) {
33 return err;
35 return mpf_ln(a, a);
37 /* a = ln b */