00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "high-precision.h"
00021
00022 #include <cmath>
00023 #include "ns3/assert.h"
00024
00025
00026 namespace ns3 {
00027
00028 HighPrecision Abs (HighPrecision const &value)
00029 {
00030 if (value.Compare (HighPrecision::Zero ()) <= 0)
00031 {
00032 HighPrecision v = HighPrecision::Zero ();
00033 v.Sub (value);
00034 return v;
00035 }
00036 else
00037 {
00038 return value;
00039 }
00040 }
00041 HighPrecision Max (HighPrecision const &a, HighPrecision const &b)
00042 {
00043 if (a.Compare (b) >= 0)
00044 {
00045 return a;
00046 }
00047 else
00048 {
00049 return b;
00050 }
00051 }
00052 HighPrecision Min (HighPrecision const &a, HighPrecision const &b)
00053 {
00054 if (a.Compare (b) <= 0)
00055 {
00056 return a;
00057 }
00058 else
00059 {
00060 return b;
00061 }
00062 }
00063
00064 };