GiNaC 1.8.7
|
This class is used to instantiate a global singleton object Digits which behaves just like Maple's Digits. More...
#include <numeric.h>
Public Member Functions | |
_numeric_digits () | |
_numeric_digits default ctor, checking for singleton invariance. More... | |
_numeric_digits & | operator= (long prec) |
Assign a native long to global Digits object. More... | |
operator long () | |
Convert global Digits object to native type long. More... | |
void | print (std::ostream &os) const |
Append global Digits object to ostream. More... | |
void | add_callback (digits_changed_callback callback) |
Add a new callback function. More... | |
Private Attributes | |
long | digits |
Number of decimal digits. More... | |
std::vector< digits_changed_callback > | callbacklist |
Static Private Attributes | |
static bool | too_late = false |
Already one object present. More... | |
This class is used to instantiate a global singleton object Digits which behaves just like Maple's Digits.
We need an object rather than a dumber basic type since as a side-effect we let it change cl_default_float_format when it gets changed. The only other meaningful thing to do with it is converting it to an unsigned, for temporarily storing its value e.g. The user must not create an own working object of this class! Since C++ forces us to make the class definition visible in order to use an object we put in a flag which prevents other objects of that class to be created.
GiNaC::_numeric_digits::_numeric_digits | ( | ) |
_numeric_digits default ctor, checking for singleton invariance.
Definition at line 2520 of file numeric.cpp.
References too_late.
_numeric_digits & GiNaC::_numeric_digits::operator= | ( | long | prec | ) |
Assign a native long to global Digits object.
Definition at line 2537 of file numeric.cpp.
References callbacklist, and digits.
GiNaC::_numeric_digits::operator long | ( | ) |
Convert global Digits object to native type long.
Definition at line 2553 of file numeric.cpp.
void GiNaC::_numeric_digits::print | ( | std::ostream & | os | ) | const |
Append global Digits object to ostream.
Definition at line 2561 of file numeric.cpp.
References digits.
Referenced by GiNaC::operator<<().
void GiNaC::_numeric_digits::add_callback | ( | digits_changed_callback | callback | ) |
|
private |
Number of decimal digits.
Definition at line 62 of file numeric.h.
Referenced by operator=(), and print().
|
staticprivate |
Already one object present.
Definition at line 63 of file numeric.h.
Referenced by _numeric_digits().
|
private |
Definition at line 65 of file numeric.h.
Referenced by add_callback(), and operator=().