Nice one Glen!!

 

I made it harder on myself by self-imposing Integers (and actually you'd
still need to handle High(Files) for 0, 1 and 2 separately as these will
trap Log10() with a ZeroDivide error in my case.   DOH!

 

J

 

That was a fun diversion tho. 

 

From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On
Behalf Of Glenn Crouch
Sent: Tuesday, 11 January 2011 14:37
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] Maths problem for the day

 

Something akin to:

 

                Max := Int (Math.Log10 (High (Files)/ 3.0 - 0.1)) *
BiasPositon;

 

Above assumes Max is a Float need to convert to Integer otherwise :)

 

Glenn Crouch,  <mailto:gl...@esbconsult.com> mailto:gl...@esbconsult.com
ESB Consultancy,  <http://www.esbconsult.com/> http://www.esbconsult.com

Follow us on Twitter: http://twitter.com/esbglenn 
Home of ESBPCS and ESB Calculators

Kalgoorlie-Boulder, Western Australia 

 

From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On
Behalf Of Ross Levis
Sent: Tuesday, 11 January 2011 9:25 am
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Maths problem for the day

 

Convert the following into one line.

 

if High(Files) < 30 then Max := Bias.Position

else if High(Files) < 300 then Max := Bias.Position*2

else if High(Files) < 3000 then Max := Bias.Position*3

else if High(Files) < 30000 then Max := Bias.Position*4

etc

 

I think there must be a way. Probably using the Power function, but I can't
get my head around it.

 

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to