Thread: Inverting Axis
View Single Post
  #12   Spotlight this post!  
Unread 02-02-2015, 13:59
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Inverting Axis

Quote:
Originally Posted by GeeTwo View Post
Provided that the code is equally (or arguably better) readable by people, why not give the computer the simplest directions?
For an example where the simpler code is not easier to read:

Logically, you want to do a conditional:

if (c is between a and b, and you don't know whether a is larger or smaller than b) then...

Human simpler (use this!):

if ((a<b) && (b<c) || (a>b) && (b>c)) then..

Probably machine quicker, but don't use:

if ((a-b)*(b-c) > 0) then..
Reply With Quote