File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 39
39
#define ATM_NAMESPACE atm
40
40
#endif
41
41
42
+ #include <cmath>
43
+
44
+ ATM_NAMESPACE_BEGIN
45
+
46
+ double atm_round (double number );
47
+
48
+ ATM_NAMESPACE_END
49
+
42
50
#endif /*!_ATM_COMMON_H_*/
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ using std::cout;
36
36
37
37
ATM_NAMESPACE_BEGIN
38
38
39
+ // round function
40
+ double atm_round(double number) {
41
+ return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5);
42
+ }
43
+
39
44
// Constructors
40
45
41
46
@@ -176,7 +181,7 @@ ATM_NAMESPACE_BEGIN
176
181
if(nu<1.0){
177
182
vp=0;
178
183
}else{
179
- vp = (int) round ((nu+1.0)/2.0);
184
+ vp = (int) atm_round ((nu+1.0)/2.0);
180
185
vp=vp-1;
181
186
}
182
187
return vp;
Original file line number Diff line number Diff line change @@ -374,14 +374,14 @@ void RefractiveIndexProfile::mkRefractiveIndexProfile()
374
374
if (v_chanFreq_.size()>1){
375
375
if(nc==0){
376
376
width = fabs(v_chanFreq_[nc+1]-v_chanFreq_[nc])*1e-9; // width en GHz para ATM
377
- npoints=(size_t)round (width*100); // One point every 10 MHz
377
+ npoints=(size_t)atm_round (width*100); // One point every 10 MHz
378
378
}else{
379
379
if(nc==v_chanFreq_.size()-1){
380
380
width = fabs(v_chanFreq_[nc]-v_chanFreq_[nc-1])*1e-9; // width en GHz para ATM
381
- npoints=(size_t)round (width*100); // One point every 10 MHz
381
+ npoints=(size_t)atm_round (width*100); // One point every 10 MHz
382
382
}else{
383
383
width = fabs((v_chanFreq_[nc+1]-v_chanFreq_[nc-1])/2.0)*1e-9; // width en GHz para ATM
384
- npoints=(size_t)round (width*100); // One point every 10 MHz
384
+ npoints=(size_t)atm_round (width*100); // One point every 10 MHz
385
385
}
386
386
}
387
387
}else{
You can’t perform that action at this time.
0 commit comments