answersLogoWhite

0


Best Answer

No. Not unless the value contained is an integer value, and the number of digits is less than the resolution of the int type. Most doubles support about 15 digits of resolution, while 32 bit integers only support 9. You might be successful in a 64 bit int format, but you still need to consider the maximum value.

The only thing the type cast buys you is elimination of the compiler warning. With the type cast, you are telling the compiler that you know what you are doing.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Will a type cast allow you to convert a double to int without data loss?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why nickel is only use for weld the cast iron?

Nickel is used mainly because cast iron is brittle and very suseptable to rapid heat change. The nickel rods allow the weld to heat and contract without causing cracks. you can also help this process be heating the cast iron to cherry red and when welded allow it to cool wrapped in rock wool. this allows for a slow cooling helping to prevent cracking.


Why long data type converted to double by multiplying by 1.0?

If two numbers are involved in a calculation (in this case a multiplication), the result is converted to the more precise data type, to avoid data loss. Even though between long and double data can be lost in either direction, a number with decimals (such as double) is generally considered to be more precise than a number without decimals (such as long). Even though languages such as Java also have a "float" data type, "double" is normally used by default in cases such as these, because of the greater precision. However, you can convert explicitly to float, if you like, using a cast. (Float uses 4 bytes, while double uses 8 bytes.)


What is the thermal conductivity of Cast iron?

Thermal conductivity refers to the measure of the ability of a material to allow the flow of heat from its warmer surface to its colder surface. The thermal conductivity of cast iron is 80 Wm-1K-1.


Why are steels more difficult to cast than a cast iron?

mainly because during the welding process cast iron; being brittle, is prone to cracking. ways to prevents this are to preheat the whole piece to cherry red and when completed allow it to slow cool by wrapping in rock wool.


Size of a variable without using sizeof operator?

Declare 2 pointer variable of the same type and assign the address of the variable to them and then increment one of them. Find the difference between the above 2 pointers using a type cast. This will be the size of the variable. Eg: double i; double * p = &i; double * q= p; p++; cout<<(int)p-(int)q<<endl;

Related questions

How much does a small leg cast weigh?

A small leg cast can weigh anywhere from 3-5 lbs. The cast must usually be light weight in order to allow for the bone to set without too much strain on the leg.


What actors and actresses appeared in The Convert - 2013?

The cast of The Convert - 2013 includes: Nikolai Kiselev


What actors and actresses appeared in The Convert - 1995?

The cast of The Convert - 1995 includes: Patrick Ferguson as The Christian


What does a runescape mud staff do?

A mud staff is a hybrid of an earth and water staff. It will allow the players to cast spells without both water and earth runes in their inventory.


What happens when java program attempts to divide one integer by another?

In that case, unless you specifically convert ("cast") at least one of the numbers to a double or float, the result will also be an integer. Example: 1 / 3 = 0


Why nickel is only use for weld the cast iron?

Nickel is used mainly because cast iron is brittle and very suseptable to rapid heat change. The nickel rods allow the weld to heat and contract without causing cracks. you can also help this process be heating the cast iron to cherry red and when welded allow it to cool wrapped in rock wool. this allows for a slow cooling helping to prevent cracking.


How do we convert between an int to a char?

With an explicit cast, for example (in Java): int i = 0; char c; c = (char) i; Please note that data may be lost in such a conversion; the explicit cast basically tells the compiler "go ahead; I know what I am doing". Without an explicit cast, the compiler won't accept the conversion.


Why long data type converted to double by multiplying by 1.0?

If two numbers are involved in a calculation (in this case a multiplication), the result is converted to the more precise data type, to avoid data loss. Even though between long and double data can be lost in either direction, a number with decimals (such as double) is generally considered to be more precise than a number without decimals (such as long). Even though languages such as Java also have a "float" data type, "double" is normally used by default in cases such as these, because of the greater precision. However, you can convert explicitly to float, if you like, using a cast. (Float uses 4 bytes, while double uses 8 bytes.)


What actors and actresses appeared in His Convert - 1915?

The cast of His Convert - 1915 includes: Marc McDermott as Gerald Morgan Mabel Trunnelle as Lizzie


What actors and actresses appeared in Hannibal rough Stuff 13 - 2008?

The cast of Hannibal Ruff Stuff 14 - 2008 includes: Double Stone


What actors and actresses appeared in Her Convert - 1915?

The cast of Her Convert - 1915 includes: Harry Carey as The Converted Cracksman Charles West as The Old Inventor


What does it mean to bivalve a cast?

To bivalve a cast means to cut it on both sides from top of the cast to the toes so it can "open up" and allow for swelling. After cut, the cast is usually held together with an Ace bandage to keep it in place. A cast is usually bivlaved after a surgey or immediately after an injury to stabilize a body part AND allow for sweilling.