Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to cast one or the other to a <code>float</code> or <code>double</code>.</p> <pre><code>int x = 1; int y = 3; // Before x / y; // (0!) // After ((double)x) / y; // (0.33333...) x / ((double)y); // (0.33333...) </code></pre> <p>Of course, make sure that you are store the <em>result</em> of the division in a <code>double</code> or <code>float</code>! It doesn't do you any good if you store the result in another <code>int</code>.</p> <hr> <p>Regarding @Chad's comment ("<code>[tailsPerField setIntValue:tailsPer]</code>"):</p> <p>Don't pass a double or float to <a href="http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSControl_Class/Reference/Reference.html#//apple_ref/occ/instm/NSControl/setIntValue:" rel="noreferrer"><code>setIntValue</code></a> when you have <a href="http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSControl_Class/Reference/Reference.html#//apple_ref/occ/instm/NSControl/setDoubleValue:" rel="noreferrer"><code>setDoubleValue</code></a>, etc. available. That's probably the same issue as I mentioned in the comment, where you aren't using an explicit cast, and you're getting an invalid value because a double is being read as an int.</p> <p>For example, on my system, the file:</p> <pre><code>#include &lt;stdio.h&gt; int main() { double x = 3.14; printf("%d", x); return 0; } </code></pre> <p>outputs:</p> <pre>1374389535</pre> <p>because the double was attempted to be read as an int.</p>
    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. 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