answersLogoWhite

0


Best Answer

When assigning a literal value, such as 5.628, to a float variable, you can avoid the decimal truncation warning by either using the float form of the constant (float var = 5.628f), typecasting the assignment (float var = (float) 5.628), or by making the variable double (double var = 5.628).

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When you assign the value 5.628 into a float variable how can you avoid getting the decimal truncation warning?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can an short value be assigned to int variable?

Yes, but you may cause truncation error because the short variable does not necessarily have the same range as an int variable. Most modern compilers will flag this as a warning. If you know that the value of the int variable will not exceed the range of a short variable, you can explicitly prevent the warning with a typecast, i.e. someShort = (short) someInt; and the compiler will assume that you know what you are doing.


What happens if you try to find address of register variable?

Either you get a compiler error. Or you get a compiler warning, and the variable won't be stored in register.


How do you round 18.6666 to zero decimal place?

18.6666 rounded to the nearest zero decimal place would be 19 Warning: Writing 19.0 gives 1 decimal place, so make sure you don't do that!


How do you get rid of a 'Right operand of assignment does not have a compatible pointer type' warning?

Depends on your code. Post it, along with your variable declarations.


How can you get a warning when an earthquake is about to happen?

you notice your mother getting to her feet...


What are the consequences for violating Florida curfew?

probably just getting a warning


What is the round warning light on a MB SL 320 immediately right of the oil temperature warning light?

The brake pads are getting thin. That sensor is for the brake pads.


How do you clear the brake warning light on an Audi SQ5?

Don't ignore the light. It's telling you to have the brakes inspected.


How do you reset vsc warning lite 2003 highlander?

If you are sure that it is the VSC (Variable Skid Control) warning light - it is not a warning light that you "re-set" like the service reminder, or the air pressure reminder, lights. It is a true warning light that something with either the braking system, or the skid detection system, is not functioning correctly. The only way to shut it off is to correct the problem. Get it to a dealer ASAP to get it checked.


What are the military warning signals?

There are several way of getting across a warning signal. For example, hand signals, alarms, and code phrases are good means of low-key communication.


In Microsoft C plus plus 2008 Visual Studio you get the warning C4700 uninitialized local variable used warning I dont get it please explain simply Im 11?

Warning C4700 means exactly what it says. You used an uninitialized local variable in an expression. A local variable is one which is declared and defined in local scope, which means within the braces of a function. Uninitialized means that you did not assign a value to the variable before you used it in some expression. Think of it as a piece of paper. You tell someone that you wrote your phone number on it, and you hand it to them. Problem is that you did not write anything on it. That is like an uninitialized variable. Local is a little bit more complicated. Think of it as several pads of paper. You use one for each person you meet. Each time you meet them, you write your phone number on the pad, tear a page off, and hand it to them. Each person has their own pad. The pads don't mix. That's like local.


Can you get in the WikiReviewers if you have had formal warnings from a supervisor?

Having a warning does not always keep a site member from getting into the WikiReviewers. It depends on what the warning was for, how recent it was, and if the member seems to have changed the behavior. Each request will be evaluated individually.