26#ifndef _CXSC_L_REAL_HPP_INCLUDED
27#define _CXSC_L_REAL_HPP_INCLUDED
35#include "interval.hpp"
43#ifdef CXSC_USE_TLS_PREC
46extern __declspec(thread)
int stagprec;
48extern __thread
int stagprec;
99 l_real & operator =(
const lx_real &)
noexcept;
106 explicit l_real(
int)
noexcept;
108 explicit l_real(
long)
noexcept;
114 explicit l_real(
const double &)
noexcept;
477 void _clear(
int)
noexcept;
489 inline real& elem(
int i)
const noexcept {
return data[i-1]; }
495 bool operator ==(
const l_real &,
const l_real &)
noexcept;
496 bool operator !=(
const l_real &,
const l_real &)
noexcept;
497 bool operator <(
const l_real &,
const l_real &)
noexcept;
498 bool operator >(
const l_real &,
const l_real &)
noexcept;
499 bool operator <=(
const l_real &,
const l_real &)
noexcept;
500 bool operator >=(
const l_real &,
const l_real &)
noexcept;
502 bool operator ==(
const real &,
const l_real &)
noexcept;
503 bool operator !=(
const real &,
const l_real &)
noexcept;
504 bool operator <(
const real &,
const l_real &)
noexcept;
505 bool operator >(
const real &,
const l_real &)
noexcept;
506 bool operator <=(
const real &,
const l_real &)
noexcept;
507 bool operator >=(
const real &,
const l_real &)
noexcept;
509 bool operator ==(
const l_real &,
const real &)
noexcept;
510 bool operator !=(
const l_real &,
const real &)
noexcept;
511 bool operator <(
const l_real &,
const real &)
noexcept;
512 bool operator >(
const l_real &,
const real &)
noexcept;
513 bool operator <=(
const l_real &,
const real &)
noexcept;
514 bool operator >=(
const l_real &,
const real &)
noexcept;
516 bool operator ==(
const dotprecision &,
const l_real &)
noexcept;
517 bool operator !=(
const dotprecision &,
const l_real &)
noexcept;
518 bool operator <(
const dotprecision &,
const l_real &)
noexcept;
519 bool operator >(
const dotprecision &,
const l_real &)
noexcept;
520 bool operator <=(
const dotprecision &,
const l_real &)
noexcept;
521 bool operator >=(
const dotprecision &,
const l_real &)
noexcept;
523 bool operator ==(
const l_real &,
const dotprecision &)
noexcept;
524 bool operator !=(
const l_real &,
const dotprecision &)
noexcept;
525 bool operator <(
const l_real &,
const dotprecision &)
noexcept;
526 bool operator >(
const l_real &,
const dotprecision &)
noexcept;
527 bool operator <=(
const l_real &,
const dotprecision &)
noexcept;
528 bool operator >=(
const l_real &,
const dotprecision &)
noexcept;
530 bool operator ==(
const interval &,
const l_real &)
noexcept;
531 bool operator !=(
const interval &,
const l_real &)
noexcept;
532 bool operator <(
const interval &,
const l_real &)
noexcept;
533 bool operator >(
const interval &,
const l_real &)
noexcept;
534 bool operator <=(
const interval &,
const l_real &)
noexcept;
535 bool operator >=(
const interval &,
const l_real &)
noexcept;
537 bool operator ==(
const l_real &,
const interval &)
noexcept;
538 bool operator !=(
const l_real &,
const interval &)
noexcept;
539 bool operator <(
const l_real &,
const interval &)
noexcept;
540 bool operator >(
const l_real &,
const interval &)
noexcept;
541 bool operator <=(
const l_real &,
const interval &)
noexcept;
542 bool operator >=(
const l_real &,
const interval &)
noexcept;
544 bool operator ==(
const idotprecision &,
const l_real &)
noexcept;
545 bool operator !=(
const idotprecision &,
const l_real &)
noexcept;
546 bool operator <(
const idotprecision &,
const l_real &)
noexcept;
547 bool operator >(
const idotprecision &,
const l_real &)
noexcept;
548 bool operator <=(
const idotprecision &,
const l_real &)
noexcept;
549 bool operator >=(
const idotprecision &,
const l_real &)
noexcept;
551 bool operator ==(
const l_real &,
const idotprecision &)
noexcept;
552 bool operator !=(
const l_real &,
const idotprecision &)
noexcept;
553 bool operator <(
const l_real &,
const idotprecision &)
noexcept;
554 bool operator >(
const l_real &,
const idotprecision &)
noexcept;
555 bool operator <=(
const l_real &,
const idotprecision &)
noexcept;
556 bool operator >=(
const l_real &,
const idotprecision &)
noexcept;
559 bool operator!(
const l_real& lr)
noexcept;
562inline real _real(
const l_real & a)
noexcept {
return real(a); }
563inline l_real _l_real(
const real & a)
noexcept {
return l_real(a); }
565 {
return dotprecision(a); }
566inline l_real _l_real(
const dotprecision & a)
noexcept
567 {
return l_real(a); }
568l_interval _unchecked_l_interval(
const l_real &,
const l_real &)
noexcept;
571l_real
rnd_up(
const dotprecision&);
573l_real
rnd_down(
const dotprecision&);
579 return l_real( comp(0.5,n+1) );
587 int k = StagPrec(lr);
588 for (
int i=1; i<=k; i++)
610 if ( n<-1074 || n>1023 )
611 { std::cerr <<
"Error in: "
612 <<
"times2pown(l_real& lr, interval& z, const int n): " << std::endl
613 <<
" -1074 <= n <= +1023 not fulfilled" << std::endl; exit(0); }
614 int k = StagPrec(lr);
617 real F = comp(0.5,n+1);
618 for (
int i=1; i<=k; i++)
623 if ( mt != mant(lr[i]) )
626 z += _interval(t) * F;
658 fac = n/1023; rest = n%1023;
659 for (
int k=1; k<=fac; k++)
673 fac = n/-1074; rest = n%-1074;
674 for (
int k=1; k<=fac; k++)
706 const int c1 = -1000000,
724 for (
int k=1; k<=fac; k++)
736 for (
int k=1; k<=fac; k++)
744inline bool zero_(
const l_real& lr)
noexcept
746 int i=1, p=StagPrec(lr);
750 if (sign(lr.elem(i))!=0) tmp =
false;
752 }
while(tmp && i <= p );
The Data Type dotprecision.
dotprecision(void) noexcept
Constructor of class dotprecision.
dotprecision & operator=(const dotprecision &) noexcept
Implementation of standard assigning operator.
The Data Type idotprecision.
The Scalar Type interval.
The Multiple-Precision Data Type l_interval.
The Multiple-Precision Data Type l_real.
friend std::istream & operator>>(std::istream &, l_real &) noexcept
Implementation of standard input method.
friend l_real & operator-=(l_real &, const l_real &) noexcept
Implementation of standard algebraic subtraction and allocation operation.
friend l_real rnd_down(const dotprecision &)
Rounds the argument down to the next l_real value.
friend l_real abs(const l_real &) noexcept
The absolute value of a l_real value.
friend bool operator!=(const l_real &, const l_real &) noexcept
Implementation of standard negated equality operation.
real & operator[](int) const noexcept
Access to the single components used to store the long data type value.
friend l_real adjust(const l_real &) noexcept
Sets the precision of a specific long datatype value.
friend l_real & operator/=(l_real &, const l_real &) noexcept
Implementation of standard algebraic division and allocation operation.
l_real(void) noexcept
Constructor of class l_real.
friend bool operator!(const l_real &lr) noexcept
Implementation of standard negation operation.
friend l_real & operator*=(l_real &, const l_real &) noexcept
Implementation of standard algebraic multiplication and allocation operation.
friend bool operator>=(const l_real &, const l_real &) noexcept
Implementation of standard greater-or-equal-than operation.
friend l_real mid(const l_interval &) noexcept
Returns the rounded middle of the l_interval.
friend real _l_real(const l_rmatrix_slice &) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend real _l_real(const l_rvector_slice &) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend l_real Sup(const l_interval &) noexcept
Returns the supremum of an l_interval.
friend l_real Inf(const l_interval &) noexcept
Returns the infimum of an l_interval.
friend int sign(const l_real &) noexcept
The sign of a l_real value.
friend bool operator>(const l_real &, const l_real &) noexcept
Implementation of standard greater-than operation.
friend l_real & operator+=(l_real &, const l_real &) noexcept
Implementation of standard algebraic addition and allocation operation.
l_real(const l_rmatrix_slice &) noexcept
Constructor of class l_real.
friend bool zero_(const l_real &) noexcept
Checks if the argument is zero.
friend int expo_sm(const l_real &)
Returns the minimum of the expo-function.
friend real _l_real(const l_rvector &) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend l_real operator+(const l_real &lr1) noexcept
Implementation of standard algebraic positive sign operation.
friend bool operator==(const l_real &, const l_real &) noexcept
Implementation of standard equality operation.
friend void accumulate(dotprecision &, const real &, const l_real &) noexcept
The accurate scalar product of the last two arguments added to the value of the first argument.
friend real _l_real(const l_rmatrix &) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
friend int StagPrec(const l_real &) noexcept
Returns the precision of the long datatype value.
friend bool operator<(const l_real &, const l_real &) noexcept
Implementation of standard less-than operation.
friend l_interval operator|(const l_real &, const l_real &) noexcept
Returns the convex hull of the arguments.
friend l_real rnd_up(const dotprecision &)
Rounds the argument up to the next l_real value.
friend bool operator<=(const l_real &, const l_real &) noexcept
Implementation of standard less-or-equal-than operation.
friend std::ostream & operator<<(std::ostream &, const l_real &) noexcept
Implementation of standard output method.
friend l_real operator*(const l_real &, const l_real &) noexcept
Implementation of standard algebraic multiplication operation.
friend l_real operator-(const l_real &lr1) noexcept
Implementation of standard algebraic negative sign operation.
friend l_real operator/(const l_real &, const l_real &)
Implementation of standard algebraic division operation.
friend int expo_gr(const l_real &)
Returns the maximum of the expo-function.
The Multiple-Precision Data Type l_rmatrix_slice.
The Multiple-Precision Data Type l_rmatrix.
The Multiple-Precision Data Type l_rvector_slice.
The Multiple-Precision Data Type l_rvector.
real(void) noexcept
Constructor of class real.
The namespace cxsc, providing all functionality of the class library C-XSC.
l_real Sqrt3r_l_real() noexcept
Approximation of .
l_real Ln2_l_real() noexcept
Approximation of .
l_real Pid3_l_real() noexcept
Approximation of .
l_real E_l_real() noexcept
Approximation of .
l_real Er_l_real() noexcept
Approximation of .
l_real SqrtPir_l_real() noexcept
Approximation of .
l_real LnPi_l_real() noexcept
Approximation of .
l_real l_pow2n(const int n) noexcept
Fast calculation of .
l_real rnd_up(const dotprecision &a)
Rounds the argument up to the next l_real value.
l_real Pip2_l_real() noexcept
Approximation of .
l_real Ln10r_l_real() noexcept
Approximation of .
l_real Ln10_l_real() noexcept
Approximation of .
int expo_gr(const l_interval &x)
const real minreal
Smallest positive denormalized representable floating-point number.
l_real Catalan_l_real() noexcept
Approximation of Catalan Numbers.
l_real EpPid2_l_real() noexcept
Approximation of .
l_real rnd_down(const dotprecision &a)
Rounds the argument down to the next l_real value.
l_real SqrtPi_l_real() noexcept
Approximation of .
l_real EulerGa_l_real() noexcept
Approximation of Euler Gamma.
l_real Pi2r_l_real() noexcept
Approximation of .
l_real Ln2Pi_l_real() noexcept
Approximation of .
l_real Sqrt2Pir_l_real() noexcept
Approximation of .
l_real EpPi_l_real() noexcept
Approximation of .
l_real Sqrt2Pi_l_real() noexcept
Approximation of .
l_real Sqrt3_l_real() noexcept
Approximation of .
l_real Ep2_l_real() noexcept
Approximation of .
l_real Pir_l_real() noexcept
Approximation of .
l_real Sqrt5_l_real() noexcept
Approximation of .
l_real Ep2Pi_l_real() noexcept
Approximation of .
l_real Sqrt2_l_real() noexcept
Approximation of .
l_real Ep2r_l_real() noexcept
Approximation of .
void times2pown(cinterval &x, int n) noexcept
Fast multiplication of reference parameter [z] with .
l_real Sqrt2r_l_real() noexcept
Approximation of .
l_real Pi2_l_real() noexcept
Approximation of .
l_real Sqrt7_l_real() noexcept
Approximation of .
l_real Sqrt3d2_l_real() noexcept
Approximation of .
l_real Pi_l_real() noexcept
Approximation of .
l_real Pid4_l_real() noexcept
Approximation of .
l_real Pid2_l_real() noexcept
Approximation of .
l_real EpPid4_l_real() noexcept
Approximation of .
l_real Ln2r_l_real() noexcept
Approximation of .
dotprecision _dotprecision(const real &d) noexcept