1. /* sreal.h by K.Tsuru */
  2. /*******************************
  3. RealSize and SCalcInfo class
  4. ********************************/
  5. #ifndef S_REAL_H
  6. #define S_REAL_H
  7. class RealSize : public virtual SNManager {
  8. enum { EFF_FIG = 0, HIDDEN_FIG, REAL_MAX_SIZE, BIN_DEC_MAX_SIZE};
  9. uint size[4];
  10. void Save(){
  11. size[EFF_FIG] = effFigures;
  12. size[HIDDEN_FIG] = hidden;
  13. size[REAL_MAX_SIZE] = maxSize[REAL];
  14. size[BIN_DEC_MAX_SIZE] = maxSize[BIN_DEC];
  15. }
  16. void Restore(){
  17. effFigures = size[EFF_FIG];
  18. hidden = size[HIDDEN_FIG];
  19. maxSize[REAL] = size[REAL_MAX_SIZE];
  20. maxSize[BIN_DEC] = size[BIN_DEC_MAX_SIZE];
  21. size[0] = size[1] = size[2] = size[3] = 0;
  22. }
  23. // cannot use
  24. RealSize(const RealSize&);
  25. RealSize& operator=(const RealSize&);
  26. public:
  27. /************************************************************************
  28. If PROPER bit is ON, set an efficient size for memory and FFT.
  29. TEMP_EXTEND bit should be ON when you temporaly extend effective figures.
  30. If PREF_SPEED bit is ON, set SNManager::preferSpeed = ON.
  31. See : SDouble::ProperUpPrec()
  32. *************************************************************************/
  33. uint SetEffFig(uint eff_fig, int proper = 0);
  34. RealSize(){ size[0] = size[1] = size[2] = size[3] = 0; }
  35. enum { PROPER = 1, TEMP_EXTEND = 2, PREF_SPEED = 4};
  36. RealSize(uint ef, int p = 0){
  37. size[0] = size[1] = size[2] = size[3] = 0;
  38. SetEffFig(ef, p); // includes Save()
  39. }
  40. ~RealSize(); // includes Restore()
  41. };
  42. /************************************************
  43. stucture for infomation of series and iteration
  44. all members are public
  45. *************************************************/
  46. struct SCalcInfo {
  47. static int iterationCount; // number of ireration in Newton method, etc.
  48. static ulong upToTerm; // number of summing up terms in series
  49. int ItrCounts() const {
  50. int it = iterationCount;
  51. iterationCount = 0; // reset
  52. return it;
  53. }
  54. ulong UpToTerm() const {
  55. ulong ut = upToTerm;
  56. upToTerm = 0; // reset
  57. return ut;
  58. }
  59. };
  60. #endif // S_REAL_H

sreal.h : last modifiled at 2016/09/04 14:21:36(2,053 bytes)
created at 2016/04/11 11:18:59
The creation time of this html file is 2017/10/11 16:07:52 (Wed Oct 11 16:07:52 2017).