Module: BigMathR::LogRep

Defined in:
ext/bigdecimal/math_r/logrep.c,
ext/bigdecimal/math_r/math_r.c

Overview

A module that provides the logarithmic representations. It is used internally.

Synopsis

The function names defined are the same as those in the C/C++ standard.

  • Inverse sine: :asin :casin

  • Inverse cosine: :acos :cacos

  • Inverse tangent: :atan :catan

  • Inverse hyperbolic sine: :asinh :casinh

  • Inverse hyperbolic cosine: :acosh :cacosh

  • Inverse hyperbolic tangent: :atanh :catanh

Follow, the name defined in C/C++ standard though, the function names are different.

  • Inverse cosecant: :acsc :cacsc

  • Inverse secant: :asec :casec

  • Inverse cotangent: :acot :cacot

  • Inverse hyperbolic cosecant: :acsch :cacsch

  • Inverse hyperbolic secant: :asech :casech

  • Inverse hyperbolic cotangent: :acoth :cacoth

Reference

Wolfram Mathworld - Natural Logarithm

Class Method Summary collapse

Class Method Details

.acos(x, prec) ⇒ BigDecimal

Computes the inverse cosine of x.

Examples:

BigMathR::LogRep.acos(BigDecimal('0.001'), 20) # Series expansion
#=> 0.15697963252948909942e1
BigMathR::LogRep.acos(BigDecimal('0.5'), 20) # Logarithmic reprensentation
#=> 0.10471975511965977462e1

Parameters:

  • x (Numeric)

    X-axis

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (ArgumentError)

    Occurs when prec is not a positive integer.

  • (TypeError)

    Occurs when x is not a numeric class.

Since:

  • 0.1.0



50
51
52
53
54
# File 'ext/bigdecimal/math_r/logrep.c', line 50

static VALUE
__impl_logrep_acos(VALUE unused_obj, VALUE x, VALUE prec)
{
  return acos_branch(x, prec, acos_logrep);
}

.acosh(x, prec) ⇒ BigDecimal

Computes inverse hyperbolic cosine of x.

Examples:

BigMathR::LogSqrt.acosh(2, 20) # Logarithmic presentation
#=> 0.13169578969248167086e1

Parameters:

  • x (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



166
167
168
169
170
# File 'ext/bigdecimal/math_r/logrep.c', line 166

static VALUE
__impl_logrep_acosh(VALUE unused_obj, VALUE x, VALUE prec)
{
  return acosh_branch(x, prec, acosh_logrep);
}

.acot(x, prec) ⇒ BigDecimal

Computes the inverse cotangent of x.

Examples:

BigMathR::LogRep.acot(1, 20) * 4
#=> 0.314159265358979323852e1

Parameters:

  • x (Numeric)

    X-axis

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (ArgumentError)

    Occurs when prec is not a positive integer.

  • (TypeError)

    Occurs when x is not a numeric class.

Since:

  • 0.1.0



126
127
128
129
130
# File 'ext/bigdecimal/math_r/logrep.c', line 126

static VALUE
__impl_logrep_acot(VALUE unused_obj, VALUE x, VALUE prec)
{
  return acot_branch(x, prec, acot_logrep);
}

.acoth(x, prec) ⇒ BigDecimal

Computes inverse hyperbolic cotangent of x.

Examples:

BigMathR::LogRep.acoth(2, 20)
#=> 0.54930614433405484568e0

Parameters:

  • x (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



244
245
246
247
248
# File 'ext/bigdecimal/math_r/logrep.c', line 244

static VALUE
__impl_logrep_acoth(VALUE unused_obj, VALUE x, VALUE prec)
{
  return acoth_branch(x, prec, acoth_logrep);
}

.acsc(x, prec) ⇒ BigDecimal

Computes the inverse cosecant of x.

Examples:

BigMathR::LogRep.acsc(2, 20)
#=> 0.52359877559829887308e0

Parameters:

  • x (Numeric)

    X-axis

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (ArgumentError)

    Occurs when prec is not a positive integer.

  • (TypeError)

    Occurs when x is not a numeric class.

Since:

  • 0.1.0



88
89
90
91
92
# File 'ext/bigdecimal/math_r/logrep.c', line 88

static VALUE
__impl_logrep_acsc(VALUE unused_obj, VALUE x, VALUE prec)
{
  return acsc_branch(x, prec, acsc_logrep);
}

.acsch(x, prec) ⇒ BigDecimal

Computes inverse hyperbolic cosecant of x.

Examples:

BigMathR::LogRep.acsch(1, 20)
#=> 0.88137358701954302523e0

Parameters:

  • x (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



206
207
208
209
210
# File 'ext/bigdecimal/math_r/logrep.c', line 206

static VALUE
__impl_logrep_acsch(VALUE unused_obj, VALUE x, VALUE prec)
{
  return acsch_branch(x, prec, acsch_logrep);
}

.asec(x, prec) ⇒ BigDecimal

Computes the inverse secant of x.

Examples:

BigMathR::LogRep.asec(2, 20)
#=> 0.10471975511965977462e1

Parameters:

  • x (Numeric)

    X-axis

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (ArgumentError)

    Occurs when prec is not a positive integer.

  • (TypeError)

    Occurs when x is not a numeric class.

Since:

  • 0.1.0



107
108
109
110
111
# File 'ext/bigdecimal/math_r/logrep.c', line 107

static VALUE
__impl_logrep_asec(VALUE unused_obj, VALUE x, VALUE prec)
{
  return asec_branch(x, prec, asec_logrep);
}

.asech(x, prec) ⇒ BigDecimal

Computes inverse hyperbolic secant of x.

Examples:

BigMathR::LogRep.asech(1/2r, 20)
#=> 0.13169578969248167087e1

Parameters:

  • x (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



225
226
227
228
229
# File 'ext/bigdecimal/math_r/logrep.c', line 225

static VALUE
__impl_logrep_asech(VALUE unused_obj, VALUE x, VALUE prec)
{
  return asech_branch(x, prec, asech_logrep);
}

.asinh(x, prec) ⇒ BigDecimal

Computes inverse hyperbolic cotangent of x.

Examples:

BigMathR::LogRep.asinh(1/2000r, 20) # Series expansion
#=> 0.49999997916666901e-3
BigMathR::LogRep.asinh(1, 20) # Logarithmic representation
#=> 0.88137358701954302523e0

Parameters:

  • x (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (ArgumentError)

    Occurs when prec is not a positive integer.

  • (TypeError)

    Occurs when x is not a numeric class.

Since:

  • 0.1.0



147
148
149
150
151
# File 'ext/bigdecimal/math_r/logrep.c', line 147

static VALUE
__impl_logrep_asinh(VALUE unused_obj, VALUE x, VALUE prec)
{
  return asinh_branch(x, prec, asinh_logrep);
}

.atan(x, prec) ⇒ BigDecimal

Computes the inverse tangent of x.

Examples:

-BigMathR::LogRep.atan(-1, 20).mult(4, 20)
#=> 0.31415926535897932385e1

Parameters:

  • x (Numeric)

    X-axis

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (ArgumentError)

    Occurs when prec is not a positive integer.

  • (TypeError)

    Occurs when x is not a numeric class.

Since:

  • 0.1.0



69
70
71
72
73
# File 'ext/bigdecimal/math_r/logrep.c', line 69

static VALUE
__impl_logrep_atan(VALUE unused_obj, VALUE x, VALUE prec)
{
  return atan_branch(x, prec, atan_logrep);
}

.atanh(x, prec) ⇒ BigDecimal

Computes inverse hyperbolic tangent of x.

Examples:

BigMathR::LogRep.atanh(1/3r, 20) # Series expansion
#=> 0.3465735902799726547e0
BigMathR::LogRep.atanh(9999/10000r, 20) # Logarithmic representation
#=> 0.49517187756430431886e1

Parameters:

  • x (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

  • (BigDecimal)

    Real solution

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



187
188
189
190
191
# File 'ext/bigdecimal/math_r/logrep.c', line 187

static VALUE
__impl_logrep_atanh(VALUE unused_obj, VALUE x, VALUE prec)
{
  return atanh_branch(x, prec, atanh_logrep);
}

.cacos(z, prec) ⇒ Complex

Computes complex inverse cosine of z.

Examples:

BigMathR::LogRep.cacos(1+1i, 20)
#=> (0.9045568943023813642e0-0.1061275061905035652e1i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



282
283
284
285
286
# File 'ext/bigdecimal/math_r/logrep.c', line 282

static VALUE
__impl_logrep_cacos(VALUE unused_obj, VALUE z, VALUE prec)
{
  return cacos_branch(z, prec, cacos_logrep);
}

.cacosh(z, prec) ⇒ Complex

Computes complex inverse hyperbolic cosine of z.

Examples:

BigMathR::LogSqrt.cacosh(1+1i, 20)
#=> (0.1061275061905035652e1+0.9045568943023813642e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



396
397
398
399
400
# File 'ext/bigdecimal/math_r/logrep.c', line 396

static VALUE
__impl_logrep_cacosh(VALUE unused_obj, VALUE z, VALUE prec)
{
  return cacosh_branch(z, prec, cacosh_logrep);
}

.cacot(z, prec) ⇒ Complex

Computes complex inverse cotangent of z.

Examples:

BigMathR::LogRep.cacot(1+1i, 20)
#=> (0.55357435889704525152e0-0.40235947810852509365e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



358
359
360
361
362
# File 'ext/bigdecimal/math_r/logrep.c', line 358

static VALUE
__impl_logrep_cacot(VALUE unused_obj, VALUE z, VALUE prec)
{
  return cacot_branch(z, prec, cacot_logrep);
}

.cacoth(z, prec) ⇒ Complex

Computes complex inverse hyperbolic cotangent of z.

Examples:

BigMathR::LogSqrt.cacoth(1+1i, 20)
#=> (0.40235947810852509365e0-0.55357435889704525152e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



472
473
474
475
476
# File 'ext/bigdecimal/math_r/logrep.c', line 472

static VALUE
__impl_logrep_cacoth(VALUE unused_obj, VALUE z, VALUE prec)
{
  return cacoth_branch(z, prec, cacoth_logrep);
}

.cacsc(z, prec) ⇒ Complex

Computes complex inverse cosecant of z.

Examples:

BigMathR::LogRep.cacsc(1+1i, 20)
#=> (0.45227844715119068206e0-0.53063753095251782602e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



320
321
322
323
324
# File 'ext/bigdecimal/math_r/logrep.c', line 320

static VALUE
__impl_logrep_cacsc(VALUE unused_obj, VALUE z, VALUE prec)
{
  return cacsc_branch(z, prec, cacsc_logrep);
}

.cacsch(z, prec) ⇒ Complex

Computes complex inverse hyperbolic cosecant of z.

Examples:

BigMathR::LogSqrt.cacsch(1+1i, 20)
#=> (0.53063753095251782602e0-0.45227844715119068206e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



434
435
436
437
438
# File 'ext/bigdecimal/math_r/logrep.c', line 434

static VALUE
__impl_logrep_cacsch(VALUE unused_obj, VALUE z, VALUE prec)
{
  return cacsch_branch(z, prec, cacsch_logrep);
}

.casec(z, prec) ⇒ Complex

Computes complex inverse secant of z.

Examples:

BigMathR::LogRep.casec(1+1i, 20)
#=> (0.11185178796437059372e1+0.53063753095251782602e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



339
340
341
342
343
# File 'ext/bigdecimal/math_r/logrep.c', line 339

static VALUE
__impl_logrep_casec(VALUE unused_obj, VALUE z, VALUE prec)
{
  return casec_branch(z, prec, casec_logrep);
}

.casech(z, prec) ⇒ Complex

Computes complex inverse hyperbolic secant of z.

Examples:

BigMathR::LogRep.casech(1+1i, 20)
#=> (0.53063753095251782602e0-0.11185178796437059372e1i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



453
454
455
456
457
# File 'ext/bigdecimal/math_r/logrep.c', line 453

static VALUE
__impl_logrep_casech(VALUE unused_obj, VALUE z, VALUE prec)
{
  return casech_branch(z, prec, casech_logrep);
}

.casin(z, prec) ⇒ Complex

Computes complex inverse sine of z.

Examples:

BigMathR::LogRep.casin(1+1i, 20)
#=> (0.6662394324925152551e0+0.1061275061905035652e1i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



263
264
265
266
267
# File 'ext/bigdecimal/math_r/logrep.c', line 263

static VALUE
__impl_logrep_casin(VALUE unused_obj, VALUE z, VALUE prec)
{
  return casin_branch(z, prec, casin_logrep);
}

.casinh(z, prec) ⇒ Complex

Computes complex inverse hyperbolic sine of z.

Examples:

BigMathR::LogSqrt.casinh(1+1i, 20)
#=> (0.1061275061905035652e1+0.6662394324925152551e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



377
378
379
380
381
# File 'ext/bigdecimal/math_r/logrep.c', line 377

static VALUE
__impl_logrep_casinh(VALUE unused_obj, VALUE z, VALUE prec)
{
  return casinh_branch(z, prec, casinh_logrep);
}

.catan(z, prec) ⇒ Complex

Computes complex inverse tangent of z.

Examples:

BigMathR::LogRep.catan(1+1i, 20)
#=> (0.10172219678978513678e1+0.40235947810852509365e0i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



301
302
303
304
305
# File 'ext/bigdecimal/math_r/logrep.c', line 301

static VALUE
__impl_logrep_catan(VALUE unused_obj, VALUE z, VALUE prec)
{
  return catan_branch(z, prec, catan_logrep);
}

.catanh(z, prec) ⇒ Complex

Computes complex inverse hyperbolic tangent of z.

Examples:

BigMathR::LogRep.catanh(1+1i, 20)
#=> (0.40235947810852509365e0+0.10172219678978513678e1i)

Parameters:

  • z (Numeric)

    Numerical argument

  • prec (Integer)

    Arbitrary precision

Returns:

Raises:

  • (TypeError)

    prec is not an Integer

  • (RangeError)

    prec is zero or negative number

Since:

  • 0.1.0



415
416
417
418
419
# File 'ext/bigdecimal/math_r/logrep.c', line 415

static VALUE
__impl_logrep_catanh(VALUE unused_obj, VALUE z, VALUE prec)
{
  return catanh_branch(z, prec, catanh_logrep);
}