Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Best search algorithm to find a condition within a range. Date: Tue, 07 Apr 2015 20:58 +0200 Organization: PointedEars Software (PES) Lines: 23 Message-ID: <5902185.dpbNY2YNC7@PointedEars.de> References: <87vbh8yvgv.fsf@bsb.me.uk> <777f7633-724b-442e-864b-d6484c5e87cf@googlegroups.com> <87pp7gysv5.fsf@bsb.me.uk> <2186a589-be06-4453-affc-3c84f9e48379@googlegroups.com> <87egnwymxr.fsf@bsb.me.uk> <2016084.ADp8TKvx9G@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: solani.org 1428433204 17973 eJwNyskBACAIA7CV5GplHQH3H0HfSRgERUfA48YdWdmKBPcI289qDOwjJUvdSppnQ/Q39jwFrhBU (7 Apr 2015 19:00:04 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 7 Apr 2015 19:00:04 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwVwokRACEIBLCW5FukHNaT/ktwbpIwCE46Ah7zs/ZuJNC0r23omntGZWmOhhRh5SNM38rN1bfyBnqdOnxUGhWR Cancel-Lock: sha1:c+Lqp0RoYWPCUXqkGHgKwpr9wMs= X-NNTP-Posting-Host: eJwFwYEBACAEBMCVwqPGycf+I3TnFhJMhAd8fJ5cVJvV7rzYpMzBUsLAZJxez0b1FLyGdT8oPhG3 Xref: csiph.com comp.lang.javascript:27245 Evertjan. wrote: > jonas.thornvall@gmail.com wrote on 07 apr 2015 in comp.lang.javascript: >> Well i do not even worry about the multiplications divisions >> subtractions and additions. Because it is already implemented i worry >> about the comparissons, because there is no straightforward way to make >> them bignum. Q.E.D. > How come? > > Integer comparison [1 's'] is just substraction > followed by testing for zero, positive or negative. I would simply pad the shorter number with zeroes on the left and compare the strings instead. After all, "0" < "9" < "A" < "Z". -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.