Click here to Skip to main content
15,885,365 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Creating c++ static library that uses 3rd party static libraries. Pin
Richard MacCutchan1-Feb-21 9:09
mveRichard MacCutchan1-Feb-21 9:09 
GeneralRe: Creating c++ static library that uses 3rd party static libraries. Pin
Maximilien3-Feb-21 3:29
Maximilien3-Feb-21 3:29 
GeneralRe: Creating c++ static library that uses 3rd party static libraries. Pin
Richard MacCutchan3-Feb-21 5:27
mveRichard MacCutchan3-Feb-21 5:27 
AnswerRe: Creating c++ static library that uses 3rd party static libraries. Pin
Mircea Neacsu1-Feb-21 9:11
Mircea Neacsu1-Feb-21 9:11 
Questionc++ Pin
Member 1505868328-Jan-21 4:05
Member 1505868328-Jan-21 4:05 
AnswerRe: c++ Pin
jeron128-Jan-21 4:30
jeron128-Jan-21 4:30 
QuestionSet precision based on a condition in cout Pin
amine zawix27-Jan-21 23:24
amine zawix27-Jan-21 23:24 
AnswerRe: Set precision based on a condition in cout Pin
11917640 Member 28-Jan-21 1:25
11917640 Member 28-Jan-21 1:25 
I made the following change, and result is as expected:

C++
double x = asDouble(-2147483648.0, 4);    // instead of asDouble(-2147483648, 4);


Your code is not compiled for me, the error is:

error C4146: unary minus operator applied to unsigned type, result still unsigned


So, your conditional precision is OK, the problem is that 2147483648 is more than maximal unsigned int value, and applying unary minus operator to it gives compiler error in my case, and unexpected result in your case. Probably your compiler gives some warning for this line, don't ignore it.

Output:

-214748.3648
0.5456


Tested with VC++ 2015.

modified 28-Jan-21 7:33am.

QuestionAdd Window procedure to picture control Pin
Gopi Nath26-Jan-21 18:02
Gopi Nath26-Jan-21 18:02 
AnswerRe: Add Window procedure to picture control Pin
CPallini26-Jan-21 20:30
mveCPallini26-Jan-21 20:30 
GeneralRe: Add Window procedure to picture control Pin
Gopi Nath26-Jan-21 22:04
Gopi Nath26-Jan-21 22:04 
AnswerRe: Add Window procedure to picture control Pin
Victor Nijegorodov26-Jan-21 20:35
Victor Nijegorodov26-Jan-21 20:35 
GeneralRe: Add Window procedure to picture control Pin
Gopi Nath26-Jan-21 22:08
Gopi Nath26-Jan-21 22:08 
GeneralRe: Add Window procedure to picture control Pin
Victor Nijegorodov26-Jan-21 23:32
Victor Nijegorodov26-Jan-21 23:32 
GeneralRe: Add Window procedure to picture control Pin
Gopi Nath27-Jan-21 0:51
Gopi Nath27-Jan-21 0:51 
QuestionBattleship game in C Pin
Julien JG725-Jan-21 9:28
Julien JG725-Jan-21 9:28 
AnswerRe: Battleship game in C Pin
Maximilien25-Jan-21 10:18
Maximilien25-Jan-21 10:18 
AnswerRe: Battleship game in C Pin
Richard MacCutchan25-Jan-21 21:47
mveRichard MacCutchan25-Jan-21 21:47 
QuestionRe: Battleship game in C Pin
David Crow26-Jan-21 4:16
David Crow26-Jan-21 4:16 
Questiontypical NASM usage Pin
Calin Negru23-Jan-21 23:29
Calin Negru23-Jan-21 23:29 
GeneralRe: typical NASM usage Pin
Richard MacCutchan24-Jan-21 0:55
mveRichard MacCutchan24-Jan-21 0:55 
AnswerRe: typical NASM usage Pin
harold aptroot24-Jan-21 17:27
harold aptroot24-Jan-21 17:27 
GeneralRe: typical NASM usage Pin
Calin Negru24-Jan-21 20:23
Calin Negru24-Jan-21 20:23 
Questiondicom error Pin
sureshpondicherry21-Jan-21 7:46
sureshpondicherry21-Jan-21 7:46 
AnswerRe: dicom error Pin
Richard MacCutchan21-Jan-21 22:02
mveRichard MacCutchan21-Jan-21 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.