Post Reply 
Any languages able to program (0,1] mathematical interval
04-29-2017, 07:29 PM
Post: #10
RE: Any languages able to program (0,1] mathematical interval
(04-28-2017 09:23 PM)pier4r Wrote:  
(04-28-2017 01:56 PM)StephenG1CMZ Wrote:  Alternatively, is there a different way of writing such an interval concisely, yet making which is included/excluded clearer.

To emphasize the equal.

Code:

if ( (a < 0 and a < 9) or (a == 0) ) {
  //this avoid the subtle <= that may be overlooked more easily than an extended condition. 
  //Code maintenance is more important than performance most of the time. Brain time is more precious than CPU time.
  ...code...
}

I can see that that would be less easy to skip over or mistype than "=".

I can imagine times when being able to copy the (0,9] syntax in a spec into the code would make it clearer that the code limits match the spec. On the other hand when implementing and debugging the code, the <= syntax or your separate < and = make it clearer what the code is doing (when (0,9] is used infrequently).

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Any languages able to program (0,1] mathematical interval - StephenG1CMZ - 04-29-2017 07:29 PM



User(s) browsing this thread: 1 Guest(s)