ROBOTC.net forums
http://robotc.net/forums/

**Error**:Operator: '%'. Illegal on operands of type ''
http://robotc.net/forums/viewtopic.php?f=1&t=8876
Page 1 of 1

Author:  sparramc [ Mon May 26, 2014 12:36 am ]
Post subject:  **Error**:Operator: '%'. Illegal on operands of type ''

Hi Guys,

I'm having this issue pop-up when I try to compile a piece of code: **Error**:Operator: '%'. Illegal on operands of type ''

Code:
void calcMyAngle() {
  useAngle = (x != 0 || y != 0);
  myAngle = atan2(-y, x);
  if (myAngle < 0)  myAngle += TWO_PI;
  myAngle = (myAngle + HALF_PI) % TWO_PI;
}


Can someone please inform me to where I've gone wrong?

Attachments:
HolonomicPS2.c [4.56 KiB]
Downloaded 237 times

Author:  mightor [ Mon May 26, 2014 2:07 am ]
Post subject:  Re: **Error**:Operator: '%'. Illegal on operands of type ''

You cannot use floats and modulus. Modulus works with whole numbers only.

= Xander

Author:  sparramc [ Mon May 26, 2014 8:13 am ]
Post subject:  Re: **Error**:Operator: '%'. Illegal on operands of type ''

Thanx Xander.

I was confident I was doing something silly.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/