Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Arithmetic operations involving <code>float</code> results in <code>float</code>.</p> <pre><code>int + float = float int * float = float float * int = float int / float = float float / int = float int / int = int </code></pre> <p>For more detail answer. Look at what the section §5/9 from the C++ Standard says</p> <blockquote> <p>Many binary operators that expect operands of arithmetic or enumeration type cause conversions and yield result types in a similar way. The purpose is to yield a common type, <strong>which is also the type of the result</strong>.</p> <p>This pattern is called the usual arithmetic conversions, which are defined as follows:</p> <p>— If either operand is of type long double, the other shall be converted to long double. </p> <p>— Otherwise, if either operand is double, the other shall be converted to double.</p> <p>— Otherwise, if either operand is float, the other shall be converted to float.</p> <p>— Otherwise, the integral promotions (4.5) shall be performed on both operands.54) </p> <p>— Then, if either operand is unsigned long the other shall be converted to unsigned long. </p> <p>— Otherwise, if one operand is a long int and the other unsigned int, then if a long int can represent all the values of an unsigned int, the unsigned int shall be converted to a long int; otherwise both operands shall be converted to unsigned long int. </p> <p>— Otherwise, if either operand is long, the other shall be converted to long.</p> <p>— Otherwise, if either operand is unsigned, the other shall be converted to unsigned. </p> <p>[Note: otherwise, the only remaining case is that both operands are int ]</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload