value range propagation for _bitwise_ OR

"Jérôme M. Berger" jeberger at free.fr
Mon Apr 12 10:45:14 PDT 2010


Steven Schveighoffer wrote:
> J�r�me M. Berger Wrote:
> 
>> J�r�me M. Berger wrote:
>>> 	OK, I found a solution that is optimal in over 99% of the cases
>>> (99.195% to be precise), while still being fast (because it avoids
>>> looping over the bits):
>>>
>> 	I've run my function and Andrei's on all possible min, max pairs in
>> 0..299 without checking, just for the timing. On my computer (Athlon
>> X2 64 @2GHz), my function took 50s and Andrei's took 266s. The
>> difference should be even bigger for larger numbers.
> 
> Can I ask, what is the point of having a non-exact solution (unless you are just doing this for fun)?
> 
> We are talking about range propagation, a function of the compiler, not a function of the compiled program.  Therefore, slower but more exact functions should be preferred, since they only affect the compile time.  Note that you will only need to do this range propagation on lines that "or" two values together, and something that reduces the runtime of the compiler by 216 seconds, but only when compiling enough code to have over 8 billion 'or' operations in it (300^4), I don't think is really that important.  Give me the exact solution that prevents me from having to cast when the compiler can prove it, even if the runtime of the compiler is slightly slower.
> 
	Funny you should say that given the current thread comparing the
speed of the D compiler to that of the Go compiler...

	We are talking about range propagation, a function of the compiler,
not a function of the compiled program. Since we can't get a 100%
accurate representation of the possible values anyway (even yours
might leave holes in the middle after all), then it might be better
to choose a faster, slightly less precise algorithm if the
difference is not too great. That's the difference between a
compiler and a full-fledged static code analysis an program prover.

	Anyway, the point is moot, I have a new version of my algorithm
with 100% precision and high speed.

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100412/5827cebd/attachment.pgp>


More information about the Digitalmars-d mailing list