semihc / qdecimal Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/qdecimal
Automatically exported from code.google.com/p/qdecimal
Reported by Aleksey Sukhonosov:
Please, take a look at the code:
QDecNumber i;
i.fromString("1.125");
qDebug()<<i.toString()<<"~"<<QString::number(i.toDouble(),'f',2)<<" or "<<QString::number(QString("1.125").toDouble(),'f',2)<<" or "<<QString::number(QString(i.toString()).toDouble(),'f',2);
i.fromString("1.375");
qDebug()<<i.toString()<<"~"<<QString::number(i.toDouble(),'f',2)<<" or "<<QString::number(QString("1.375").toDouble(),'f',2)<<" or "<<QString::number(QString(i.toString()).toDouble(),'f',2);
The output should contain an original number and this number having been
rounded. Every rounding method is supposed to give the same result. But in
debug I have:
"1.125" ~ "1.00" or "1.12" or "1.12"
"1.375" ~ "1.00" or "1.38" or "1.38"
So, it seems that QDecNumber::toDouble() works in a wrong way, as everything it
returns is of integer value (though, of double type).
Original issue reported on code.google.com by [email protected]
on 29 Jan 2012 at 12:29
In
int QDecNumberTests::opTest(const QStringList& tokens)
it says
/* Uncomment to receive more information about passing test cases: */
but it seems there is nothing to uncomment. Is this way?
Thanks for QDecimal!
Original issue reported on code.google.com by [email protected]
on 10 Aug 2013 at 5:26
> What steps will reproduce the problem?
I compiled
QDecDouble num("0.1");
QDecDouble aux = 1 + num;
cout << aux << endl;
and the result was
8.19999E-393
which is very close to zero, which is not adequate.
However, I compiled
double num(0.1);
double aux = 1 + num;
cout << aux << endl;
and the result was
1.1
which is correct. I obtained the same result using "qreal" instead of "double",
of course.
> What version of the product are you using? On what operating system?
QDecimal 1.0.1. Kubuntu 13.04.
Thanks for QDecimal!
Original issue reported on code.google.com by [email protected]
on 10 Aug 2013 at 5:48
When compiling Main.cc, `gcc` emits a warning about
void MessageOutput(QtMsgType type, const QMessageLogContext &context,
const QString &msg)
and its variable "context" that is never used.
That puzzles the developers ("A warning?" "What's happening?" "Is QDecimal well
done?" "Should I solve it?" "Can I solve it?" "Should I file a bug?"). I read
<http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html> and added
three "pragmas" in my local QDecimal copy, this way:
[...]
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
void MessageOutput(QtMsgType type, const QMessageLogContext &contexte,
const QString &msg)
{
QByteArray lmsg = msg.toLocal8Bit();
const char* cmsg = lmsg.constData();
switch (type) {
case QtDebugMsg:
fprintf(stderr, "%s\n", cmsg);
break;
case QtWarningMsg:
fprintf(stderr, "Warn: %s\n", cmsg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", cmsg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s\n", cmsg);
abort();
}
}
#pragma GCC diagnostic pop
[...]
and this way `gcc` doesn't warn about "unused parameters", but probably you'll
have a better solution to avoid warning developers (`gcc` ones, at least).
Thanks for QDecimal!
Original issue reported on code.google.com by [email protected]
on 10 Aug 2013 at 5:30
When trying to compile the project using Visual Studio 2015 or Visual Studio 2017's compiler I get errors about stdint.h, due to redefinition of int_fast16_t.
Here's the output when trying to compile it through QT Creator set to VS 2017:
qdec-compile-error.txt
What steps will reproduce the problem?
1. Attempt to instantiate a QDecNumber object from DBL_MAX double value.
QDecNumber decNum(DBL_MAX);
2. Compile and run program.
What is the expected output?
1.7976931348623158e+308
What do you see instead?
Program crashes.
What version of the product are you using? On what operating system?
1.0.0
Please provide any additional information below.
The problem stems from the fact that MaxStrSize is too small to accommodate all
representable doubles in the 'f' format specified in sprintf(str,'%f',d) in
fromDouble. Changing the format specifier to '%.16e' seems to resolve the
issue, the only downside being the forced precision of 16 decimal digits when
that might not always be the desired precision.
Original issue reported on code.google.com by [email protected]
on 11 Jul 2012 at 4:15
What steps will reproduce the problem?
1. Type nmake in any directory and receive error msg
"NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop."
2. Type nmake *.pri or *.pro and all one receives is errors,
generally of the form "Too many names to left of =" wherever a +=
token appears.
What is the expected output? What do you see instead?
Trying to compile under MS VCC; nothing happens.
What version of the product are you using?
Product: Microsoft Visual Studio Express 2012 for Windows Desktop
O/S: Windows 8
Please provide any additional information below.
In trying to compile "Example 1" under MS Viual Studio Express 2012 I get these
5 errors:
Error 14 error LNK2001: unresolved external symbol "struct decContext * __cdecl
decContextDefault(struct decContext *,int)"
(?decContextDefault@@YAPAUdecContext@@PAU1@H@Z)
Error 15 error LNK2001: unresolved external symbol "struct decNumber * __cdecl
decNumberFromString(struct decNumber *,char const *,struct decContext *)"
(?decNumberFromString@@YAPAUdecNumber@@PAU1@PBDPAUdecContext@@@Z)
Error 16 error LNK2001: unresolved external symbol "struct decNumber * __cdecl
decNumberAdd(struct decNumber *,struct decNumber const *,struct decNumber const
*,struct decContext *)"
(?decNumberAdd@@YAPAUdecNumber@@PAU1@PBU1@1PAUdecContext@@@Z)
Error 17 error LNK2001: unresolved external symbol "char * __cdecl
decNumberToString(struct decNumber const *,char *)"
(?decNumberToString@@YAPADPBUdecNumber@@PAD@Z)
Error 18 error LNK1120: 4 unresolved externals
Original issue reported on code.google.com by [email protected]
on 24 Jul 2013 at 10:07
256 bytes is not enough to represent a double number of DBL_MAX or DBL_MIN
try this,
int main(int argc, char *argv[])
{
double d = DBL_MAX;
QDecDouble dd(d);
}
and see the application happily crash.
Original issue reported on code.google.com by [email protected]
on 17 Jan 2012 at 2:24
Hello
I got the following problem:
I coudent figure out how to round after a callculation with the QDecDouble Type.
This is my code:
QDecDouble test(12.0003); QDecContext con; con.setDigits(4); con.setRound(DEC_ROUND_HALF_UP); test = test.add(QDecDouble(12.0003),&con); //result of the calculation is 24.0006, expectet result after rounding is 24.0010 but result still the same (24.0006)
i don't see the problem.
Thx for the help its very appriciatet and thx very mutch for QDecimal.
Regards Sascha
What steps will reproduce the problem?
1. Qmake -r
2. mingw32-make
What is the expected output? What do you see instead?
Compiled library
What version of the product are you using? On what operating system?
QT4.8 command prompt
Please provide any additional information below.
g++: /Zc:forScope: No such file or directory
g++: /Zc:wchar_t: No such file or directory
g++: /RTC1: No such file or directory
mingw32-make[2]: *** [debug/QDecContext.o] Error 1
mingw32-make[2]: Leaving directory `D:/Lähdekoodeja/qdecimal/src'
mingw32-make[1]: *** [debug] Error 2
mingw32-make[1]: Leaving directory `D:/Lähdekoodeja/qdecimal/src'
mingw32-make: *** [sub-src-make_default-ordered] Error 2
Original issue reported on code.google.com by [email protected]
on 14 Apr 2014 at 7:10
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.