Dave,
What if someone lays a book on the ESC key? What happened to the previous setting of ON ESCAPE? What if you want all applications to use F10 instead of ESC?
Of course, if you don't believe in resuable code, that's cool.
Tony
You can add this to your loop to allow it to be ended (interrupted) by pressing the escape key.
*___________________________________________________________________
*
* CANCEL OBJECT CLASS
* Version = 1.0
* Copyright (C) 2002 Vignone...
Some time ago, I wrote a DOS program that reads a dbf and outputs a space delimited text file. You could then modify it an import it into a new dbf.
If you would give me your email address, I can send you the EXE.
Tony
Wayne,
No, a little longer. I love a challenge.
You might what to improve in the two routines that get the 3rd reel, getLargeThird and getAnyThird. They should get one that is closer to the size of the smaller or a multiple of the smaller or ... anything else that you can think of.
Tony
Wayne,
I cleaned up the program and defined a class for the reels. This way you can use the program as is (if it has any value to you) and implement your own reel class in a more appropiate way.
Keep in mind, I still suspect that this is an Operations Research type of problem requiring Linear...
Wayne,
Second thoughts lead to an enhancement of the invariant:
"We want always to braid two reels with minimum difference (both reels less than the maximum one) with a third reel that is 100' longer than the shortest of the first two.
Here is a rough program that utilizes that invariant...
Wayne,
My first thoughts are for the invariant of a loop.
Let's see ... we want always to braid two reels with minimum difference with a third reel that is 100' longer than the shortest of the first two. In your example, that would be 265 and 275 (leaving scrap of 10') braided with any other...
Alex,
Your problem is written in VB, However, here's the VFP version that works. I tried it with a 2x2 array.
*Setup an example
dimension strArray(2,2)
strArray(1,1) = "AAA"
strArray(1,2) = "BBB"
strArray(2,1) = "CCC"
strArray(2,2) = "DDD"
store 2 to endrow,endcol
*Run the Test
strOut = ""...
Dave,
Good show! If you put in 4.9811 with DECIMALS 4 you get back 4.98109961 and int(4.98109961*10^5) = 498109.
Voila!
It looks like assigning 4.9811 to a variable causes it to be stored internally as Single Precision Hex:409f652b which is 4.98109961 when DECIMALS is 4 and 4.9811 when...
This gets even worse.
Try this and see totally inconsistant results proving that INT is a Microsoft special math function - Hungarian Math, maybe??
Avoid the INT function!
SET DECIMALS TO 4
FOR l_nNewValue = 4.9810 to 4.9815 step .0001
? l_nNewValue
? l_nNewValue*(10^5)
...
INT must respect the mathematical meaning not the internal problem of representing integers with binary numbers. When a binary result translates to 44.99999999999999...etc, the compiler should realize that it is 45 not the floor, 44.
Tony
Dave,
You are right, the INT function is incorrect. INT(l_nNewValue*(10^5)) is returning the FLOOR since the result must be a smidgen below 498110 (in binary). It should be returning the CEILING.
I tried the same program in TRU BASIC which is a mathematical language (compiler written by...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.