Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!ames!oliveb!felix!ccicpg!cci632!ritcv!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.arch Subject: Comparison Data Message-ID: <1290@aw.sei.cmu.edu> Date: Thu, 7-May-87 15:46:48 EDT Article-I.D.: aw.1290 Posted: Thu May 7 15:46:48 1987 Date-Received: Sat, 9-May-87 18:40:42 EDT Sender: netnews@sei.cmu.edu Lines: 40 Postscript to previous post: raw data gathered from systems code. Comparison % var = 0 18 var >=0 12 var > 0 0 var = const 31 var >(=)const 18 var = var 19 var > var 2 var >=var 1 Each comparison counts both the test and the converse test, so 'v>0' includes 'v<=0'. The test 'v>const' includes all 4 forms, since we can always transform 'v>k' into 'v>=(k-1)'. Basically 'var' means "anything not known at compile time"; I didn't check for things like IF x > y+1 ... that can be transformed into IF x>=y. Gathered from ~12000 lines of BCPL code. Note two language-dependent sources of bias (a) strings have a length count not a NUL terminator, so we have 'i<=length' where C would have 'ch=0' (b) many library calls return a negative error code tested for by '<0' comparison Booleans are represented by (FALSE=>0, TRUE=>allones), and always tested by treating 0 as FALSE and everything else as TRUE. Hope this is informative.