## Re: [Algorithms] Matching Cross platform FP

 Re: [Algorithms] Matching Cross platform FP From: Mark Davis - 2006-07-28 02:41:16 ```>As=20an=20aside,=20for=20human-sized=20large=20worlds=20I=20was=20surpris= ed=20when=20I >calculated=20the=20mileage=20one=20can=20get=20out=20of=20using=20a=20pla= in=20old=20int32 >fixpoint=20for=20positions.=20If=20your=20game=20runs=20fine=20out=20at=20= a=20kilometer, >32-bit=20fixpoint=20gets=20you=20the=20same=20precision=20with=20a=20rang= e=20of=20+/-64km. >That's=20a=20lot=20of=20content=20to=20create! Just=20remember=20that=20if=20you=20calculate=20the=20distance=20between=20= 2=20points=20and maintain=20a=2016.16=20result,=20you=20have=20the=20possibility=20of=20ove= rflow=20if=20they are=20arranged=20diagonally=20and=20at=20opposite=20ends=20of=20your=20uni= verse.=20=20=20You should=20shift=20your=20inputs=20down=20by=201=20to=20account=20for=20the=20= 41%=20increase=20in scale=20for=20diagonals. Of=20course=20another=20advantage=20of=20an=20integer=20universe=20is=20th= at=20it=20can trivially=20WRAP!=20=20=20You=20can=20fly=20forever=20in=20a=20direction=20= and=20never=20hit=20the end=20of=20your=20universe. Integers=20are=20also=20superior=20when=20comparing=20values=20(at=20least= =20on=20Intel) because=20almost=20all=20integer=20operations=20automatically=20set=20the=20= CPU=20flag registers=20which=20can=20be=20used=20immediately=20for=20branching.=20=20= =20Float operations=20require=20an=20FPU=20compare=20operation,=20followed=20by=20r= eading=20back the=20FPU=20control=20word=20into=20the=20AX=20register,=20followed=20by=20= a=20test instruction.=20=20=20That's=20a=20minimum=20of=20three=20extra=20cycles=20= per=20compare,=20not including=20cpu/pipeline=20stalls.=20=20=20I=20don't=20wish=20to=20sound=20= like=20I'm splitting=20hairs=20here,=20but=20since=20you=20may=20do=20hundreds=20of=20= thousands=20of compares=20per=20frame,=20this=20actually=20can=20add=20up.=20=20=20Anytim= e=20you=20want=20to compare=20scalars,=20just=20avoid=20floats=20if=20you=20can. -Mark=20 ------------------------------------------------------------------------ - Take=20Surveys.=20Earn=20Cash.=20Influence=20the=20Future=20of=20IT Join=20SourceForge.net's=20Techsay=20panel=20and=20you'll=20get=20the=20ch= ance=20to=20share your opinions=20on=20IT=20&=20business=20topics=20through=20brief=20surveys=20-= -=20and=20earn=20cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DD= EVDE V _______________________________________________ GDAlgorithms-list=20mailing=20list GDAlgorithms-list@... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D6188 ______________________________________________________________________ This=20e-mail=20has=20been=20scanned=20by=20MCI=20Managed=20Email=20Conten= t=20Service,=20using Skeptic(tm)=20technology=20powered=20by=20MessageLabs.=20For=20more=20info= rmation=20on MCI's=20Managed=20Email=20Content=20Service,=20visit=20http://www.mci.com.= =20=20. ______________________________________________________________________ ______________________________________________________________________ This=20e-mail=20has=20been=20scanned=20by=20MCI=20Managed=20Email=20Conten= t=20Service,=20using=20Skeptic(tm)=20technology=20powered=20by=20MessageLa= bs.=20For=20more=20information=20on=20MCI's=20Managed=20Email=20=20Content= =20Service,=20visit=20http://www.mci.com. ______________________________________________________________________ ```