Answers.Body: <p>From the page you linked to we can see that the NXC <code>OnFwd</code> method has the following parameters:</p>
  
  <pre><code>void OnFwd (byte outputs, char pwr)
  </code></pre>
  
  <p>The power or speed parameter is listed as a <code>char</code> type, and looking around elsewhere on the site we find the <a href="http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/char.html">definition of the <code>char</code></a> to be:</p>
  
  <blockquote>
    <p>In NXC the char type is a signed 8-bit value. This type can store values from SCHAR_MIN to SCHAR_MAX.</p>
  </blockquote>
  
  <p>This means it can hold an integer value between -128 and 127.</p>
  
  <p>It cannot take any decimal values.</p>
  
  <p>I assume that a <code>char</code> was used over an <code>int</code> as they only need to support values between -100 and 100 in this method.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-03-15T10:21:22.400Z
Answers.Text: Thanks, for some reason I didn't connect value to integral value, but looking at the int and float description it's quite obvious! When I use a decimal value as a parameter there is no compiler or runtime error; I believe C would just truncate a floating point number to an integer, ao I presume it would be the same in NXT for float to char?
Answers.UserDisplayName: lpd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-03-15T10:29:22.653Z
Answers.Text: I guess so - I can't say I've tried, but yes, there's possibly some implicit conversions going on.
Answers.UserDisplayName: Zhaph - Ben Duguid
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2012-03-15T09:08:08.030Z
Answers.LastActivityDate: 2012-03-15T09:08:08.030Z
Answers.UserDisplayName: Zhaph - Ben Duguid
Body: <p>When <a href="http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___output_module_functions_gaff5b57943544cce13f2e7fcf7eb17b3c.html" rel="nofollow">turning the motors</a>, how precise is the speed parameter? I am programming in the NXC language (standard firmware) and wishing to know how many decimal points will be taken, if any, and whether the input speed will be truncated, rounded or neither.</p>
  
Tags: <nxt><mindstorms><programming><motor>
Title: NXT motor power accuracy
UserDisplayName: lpd
ThreadText: # NXT motor power accuracy
  
  (Asked by: username_0 on 2012-03-14)
  
  When [turning the motors](http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___output_module_functions_gaff5b57943544cce13f2e7fcf7eb17b3c.html), how precise is the speed parameter? I am programming in the NXC language (standard firmware) and wishing to know how many decimal points will be taken, if any, and whether the input speed will be truncated, rounded or neither.
  
  **Tags:** nxt, mindstorms, programming, motor
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2012-03-15. Score: 5 | Accepted answer
  
  From the page you linked to we can see that the NXC OnFwd method has the following parameters:
  void OnFwd (byte outputs, char pwr)
  
  The power or speed parameter is listed as a char type, and looking around elsewhere on the site we find the definition of the char to be:
  
  In NXC the char type is a signed 8-bit value. This type can store values from SCHAR_MIN to SCHAR_MAX.
  
  This means it can hold an integer value between -128 and 127.
  It cannot take any decimal values.
  I assume that a char was used over an int as they only need to support values between -100 and 100 in this method.
  
  > **Comments:**
  > **username_0**: Thanks, for some reason I didn't connect value to integral value, but looking at the int and float description it's quite obvious! When I use a decimal value as a parameter there is no compiler or runtime error; I believe C would just truncate a floating point number to an integer, ao I presume it would be the same in NXT for float to char?  
  > **username_1**: I guess so - I can't say I've tried, but yes, there's possibly some implicit conversions going on.  
  
  ---
  
  