Changeset 5310 in ntrip for trunk/BNC


Ignore:
Timestamp:
Jul 1, 2013, 12:17:20 PM (11 years ago)
Author:
weber
Message:
 
Location:
trunk/BNC/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncutils.cpp

    r5230 r5310  
    448448  sec =       (decDeg - deg - min/60.0) * 3600.0;
    449449}
     450
     451//
     452////////////////////////////////////////////////////////////////////////////
     453QString 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  
    8282void deg2DMS(double decDeg, int& deg, int& min, double& sec);
    8383
     84QString fortranFormat(double value, int width, int prec);
     85
    8486#endif
Note: See TracChangeset for help on using the changeset viewer.