summaryrefslogtreecommitdiffstats
path: root/src/numerictypes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/numerictypes.cpp')
-rw-r--r--src/numerictypes.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/numerictypes.cpp b/src/numerictypes.cpp
index 8b32c9f..c75268e 100644
--- a/src/numerictypes.cpp
+++ b/src/numerictypes.cpp
@@ -32,13 +32,13 @@ int Abakus::m_prec = -1;
namespace Abakus
{
-QString convertToString(const mpfr_ptr &number)
+TQString convertToString(const mpfr_ptr &number)
{
char *str = 0;
- QRegExp zeroKiller ("0*$");
+ TQRegExp zeroKiller ("0*$");
mp_exp_t exp;
int desiredPrecision = Abakus::m_prec;
- QString decimalSymbol = KGlobal::locale()->decimalSymbol();
+ TQString decimalSymbol = KGlobal::locale()->decimalSymbol();
if(desiredPrecision < 0)
desiredPrecision = 8;
@@ -54,10 +54,10 @@ QString convertToString(const mpfr_ptr &number)
if(exp < -2 || exp > desiredPrecision)
{
// Use exponential notation.
- QString numbers (str);
+ TQString numbers (str);
mpfr_free_str(str);
- QString sign, l, r;
+ TQString sign, l, r;
if(numbers[0] == '-')
{
sign = "-";
@@ -72,13 +72,13 @@ QString convertToString(const mpfr_ptr &number)
// Remove trailing zeroes.
if(Abakus::m_prec < 0)
- r.replace(zeroKiller, "");
+ r.tqreplace(zeroKiller, "");
// But don't display numbers like 2.e10 either.
if(r.isEmpty())
r = "0";
- r.append(QString("e%1").arg(exp - 1));
+ r.append(TQString("e%1").tqarg(exp - 1));
return sign + l + decimalSymbol + r;
}
@@ -91,12 +91,12 @@ QString convertToString(const mpfr_ptr &number)
str = mpfr_get_str (0, &exp, 10, exp + desiredPrecision, number, GMP_RNDN);
}
- QString result = str;
+ TQString result = str;
mpfr_free_str(str);
str = 0;
int position = exp;
- QString l, r, sign;
+ TQString l, r, sign;
if(position < 0) { // Number < 0.1
l.fill('0', -position);
@@ -124,7 +124,7 @@ QString convertToString(const mpfr_ptr &number)
}
// Remove trailing zeroes.
- r.replace(zeroKiller, "");
+ r.tqreplace(zeroKiller, "");
// Don't display numbers of the form .23
if(l.isEmpty())
@@ -172,25 +172,25 @@ const Abakus::number_t::value_type Abakus::number_t::E = setupExponential();
namespace Abakus
{
-QString convertToString(const HNumber &num)
+TQString convertToString(const HNumber &num)
{
- QString str = HMath::formatGenString(num, m_prec);
- QString decimalSymbol = KGlobal::locale()->decimalSymbol();
- str.replace('.', decimalSymbol);
+ TQString str = HMath::formatGenString(num, m_prec);
+ TQString decimalSymbol = KGlobal::locale()->decimalSymbol();
+ str.tqreplace('.', decimalSymbol);
- QStringList parts = QStringList::split("e", str);
- QRegExp zeroKiller("(" + QRegExp::escape(decimalSymbol) +
+ TQStringList parts = TQStringList::split("e", str);
+ TQRegExp zeroKiller("(" + TQRegExp::escape(decimalSymbol) +
"\\d*[1-9])0*$"); // Remove trailing zeroes.
- QRegExp zeroKiller2("(" + QRegExp::escape(decimalSymbol) + ")0*$");
+ TQRegExp zeroKiller2("(" + TQRegExp::escape(decimalSymbol) + ")0*$");
str = parts[0];
- str.replace(zeroKiller, "\\1");
- str.replace(zeroKiller2, "\\1");
+ str.tqreplace(zeroKiller, "\\1");
+ str.tqreplace(zeroKiller2, "\\1");
if(str.endsWith(decimalSymbol))
str.truncate(str.length() - 1); // Remove trailing period.
if(parts.count() > 1 && parts[1] != "0")
- str += QString("e%1").arg(parts[1]);
+ str += TQString("e%1").tqarg(parts[1]);
return str;
}