|
ShiningStarPxx wrote: The question is how to get 95.123 's 12th power.
Do you mean 95.12312 instead? Even using an unsigned long double , you'd get something like 5.4881562051773182e+023. You might could get a bit more precision by using the DECIMAL data type.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thank you first!
But i can not catch your means.Would you like to explain it with a sample code.
|
|
|
|
|
#include <math.h>
#include <stdio.h>
void main( void )
{
double x = 2.0, y = 3.0, z;
z = pow( x, y );
printf( "%.1f to the power of %.1f is %.1f\n", x, y, z );
}
Output
2.0 to the power of 3.0 is 8.0
|
|
|
|
|
Oops sorry, the <'s and >'s got removed, the #include's should be
#include <math.h>
#include <stdio.h>
|
|
|
|
|
On paper, 95.12312 is 548815620517731830194541.89902534. However, that number is too big to fit in any type, including an unsigned long double . It would only give you something like 5.4881562051773182e+023 (which equates to 548815620517731820000000.0). Notice the loss of precision. A DECIMAL type may get you a bit more precision.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I have an application working perfectly when compiled in the debug version with optimization off. But the release with optimization on/off and the debug version with optimization on crashes every now and then. Can someone tell me what can be the problem?
I have a places where i do the following :
Literal_Object *lit = (Literal_Object *)pt;
pt is an object Node_Object which is the base class of Literal_Object.
Can this be the cause of my problem?
Thanx in advance.
Mithin
|
|
|
|
|
Mithin wrote: Literal_Object *lit = (Literal_Object *)pt;
Can this be the cause of my problem?
No, not by itself anyway.
See if this helps any.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i have read this and tried to do everything mentoined in it. There is also a very unusual problem. When i run the release version by clicking on the start button i.e., from the IDE itself my application runs perfectly but when i execute it by double clicking on the exe from the release folder all the problems again appear.
Is there a way i can debug my release version which is executed by double clicking on the file and not running it from the IDE?
Any idea whats happening?
Thanx a lot
Mithin
|
|
|
|
|
Mithin wrote: Any idea whats happening?
Yes: the difference between the two things you mentioned is that for the first one (start it from the IDE) the default working folder will be the folder where your project files resides (.dsw, ...) and for the second one, it will be in the release folder itself (so: ...\YourProject\Release). And so, what is probably happening is that you need some external resources that are not present in the release folder but only in the project folder.
|
|
|
|
|
My project is not using any external resources because the debug version works fine. Do you have any idea which file can it be? Is there a way to avoid application depending on the external sources?
Thanx a lot
Mithin
|
|
|
|
|
Mithin wrote: My project is not using any external resources because the debug version works fine
That doesn't mean anything .
Sorry, I used the wrong word. By 'resources' I meant every file that is used by your program. It could be simply that you try to open and read a file (a simple text file for example) but your code is not secured in case of the file doesn't exist. Do you have anywhere in your program something that uses files located in the same directory ?
|
|
|
|
|
No my program is not using any external file.
Pls Help
Thanx a lot
Mithin
|
|
|
|
|
Hi,
Mithin wrote: pt is an object Node_Object which is the base class of Literal_Object.
does this mean the following
class Node_Object;
class Literal_Object : public Node_Object
{
...
};
If this is the case the following
Literal_Object *lit = (Literal_Object *)pt;
could fail if the pt object really points to an Node_Object (like you wrote), because the lit pointer could call function or access members who don't exist in the Node_Object.
If this is not the case then another reason for crashing is using uninitialized variables. In the debug environment default inits could be made that won't happen in a release build. So you should certainly check on that.
codito ergo sum
|
|
|
|
|
That should be ok, but you realy should be using "dynamic_cast<Literal_Object*>(pt); ". Then checking the return type of the cast to see if it succeded.
As to what could be causing the program to crash, I would look at memory allocations. I've seen code where a buffer was defined to hold a string that did not take into account the '\0' character at the end, that worked fine in debug and then crashed in the release version.
In my experience, most crashes are caused by an invalid memory access.
INTP
Every thing is relative...
|
|
|
|
|
I want to show user defined warning in C++
i.e. at compile time I want to show a warning message
Please tell me how this can be done…
Regards... Ankur
|
|
|
|
|
<font color=blue>#pragma warning</font> your warning here...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have tried this but this warning is not displayed
I am using Sun Studio 9 C++ compiler 5.6
Please tell me any workaround for this
Regards... Ankur
|
|
|
|
|
AnkurGupta_1981 wrote: I am using Sun Studio 9 C++ compiler 5.6
pffffff, poor boy... did you only know you where on a Visual C++ forum ?
good luck !!!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
What is the relationship between Doc and View
1)One to Many
2)One to One
3)Many to Many
4)Many to One
Choose the Correct One ? ( This is TCS Interview Question)
Praveen .C
|
|
|
|
|
a document and a view are the same. a Frame can contain several Docs/Views...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
are you certain ? a document is not contained in a frame, it's a data class.
In the Doc-View Architecture, a view is the representation of the data in the document.
A document can have multiple views attached to it, in as many frame window as you wish.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
did i misundertood this ?
"A frame-based application uses a concept known as the Document/View Architecture.
This allows the frame to serve as a place holder for other parts of an application
(such as the document and the view)."
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 9:24 Wednesday 26th October, 2005
|
|
|
|
|
you've really misunderstood the "/".
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
cant a document have multiple views??, for example, a data that is available in the DOC can be viewed as a chart in one view and in another view the same can be viewed as graph. right??
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
yes - A single document can have many views open on it simultaneously. Not all views need to be the same type for any given document. I can have 'spread sheet' document, but a view with a spreadsheet, a view with some charts, and another view with statistics all open on the 'spread sheet' document's data.
|
|
|
|