<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<div style="font-family: Tahoma; font-size: 10pt; ">Hi All,</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">I have a slightly off-topic maths question based on the following of my Delphi legacy code.</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">var </div><div style="font-family: Tahoma; font-size: 10pt; "> max_x, max_y, max_loop : integer;</div><div style="font-family: Tahoma; font-size: 10pt; ">begin</div><div style="font-family: Tahoma; font-size: 10pt; "> max_x := 35;</div><div style="font-family: Tahoma; font-size: 10pt; "> max_y := 90;</div><div style="font-family: Tahoma; font-size: 10pt; "> max_loop := trunc( max_x * max_y / 1.575 ); // gives 2000 for 35 x 90</div><div style="font-family: Tahoma; font-size: 10pt; ">[...]</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">Is 1.575 represented as a fraction? It does not seem to be. It (for what it's worth) is the square_root( 2.480625 )... but it does not seem to have any relevance.</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">What is the significance of the magic number. Max_x and Max_y are the dimensions of a 2D array and max_loop is the target population which I will filling the array with. This code goes back to year 2000 and I have no idea where the number 1.575 comes from... but it seems to work as the comment suggests. E.g. the max_loop assignment in that example gives 2000.</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">Any ideas as to the meaning of the constant? And can this be simplified? I don't think so.</div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div><font class="Apple-style-span" face="Tahoma" size="2">NB - No correlation between max_loop and year 2000... just a coincidence :-)</font></div><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div style="font-family: Tahoma; font-size: 10pt; ">Best Regards,</div><div style="font-family: Tahoma; font-size: 10pt; ">PEW</div> </body>
</html>