- Timestamp:
- Jul 1, 2013, 12:17:20 PM (11 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncutils.cpp
r5230 r5310 448 448 sec = (decDeg - deg - min/60.0) * 3600.0; 449 449 } 450 451 // 452 //////////////////////////////////////////////////////////////////////////// 453 QString fortranFormat(double value, int width, int prec) { 454 int expo = value == 0.0 ? 0 : log10(fabs(value)); 455 double mant = value == 0.0 ? 0 : value / pow(10, expo); 456 if (fabs(mant) >= 1.0) { 457 mant /= 10.0; 458 expo += 1; 459 } 460 if (expo >= 0) { 461 return QString("%1e+%2").arg(mant, width-4, 'f', prec).arg(expo, 2, 10, QChar('0')); 462 } 463 else { 464 return QString("%1e-%2").arg(mant, width-4, 'f', prec).arg(-expo, 2, 10, QChar('0')); 465 } 466 } -
trunk/BNC/src/bncutils.h
r5230 r5310 82 82 void deg2DMS(double decDeg, int& deg, int& min, double& sec); 83 83 84 QString fortranFormat(double value, int width, int prec); 85 84 86 #endif
Note:
See TracChangeset
for help on using the changeset viewer.