"Illegal Function Call" Using Coprocessor in Basic 7.10 (66560)






This article was previously published under Q66560

SYMPTOMS

The following two program examples give an "Illegal Function Call" error when run as a .EXE program using a math coprocessor; however, the programs work correctly in the QBX.EXE environment or with the coprocessor disabled.

WORKAROUND

To work around this problem, do one of the following:

  1. Break the complex equation into smaller parts that are evaluated separately. -or-

  2. Turn off use of the coprocessor with SET NO87="message" at the MS-DOS prompt. -or-

  3. Compile using the alternate math (/FPa) option.

STATUS

Microsoft has confirmed this to be a bug in Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2. We are researching this problem and will post new information here as it becomes available.

MORE INFORMATION

Code Example 1

a = .475
b = 75
c = 62
d = .007
e = 22
f = (b * e ^ 2 / d) * SQR(1 / ((2 * b * c * a) ^ 2 + (b ^ 2 - c ^ 2))
				
Simplifying the equation eliminates the problem. For example, removing the (b * e ^ 2 / d) factor eliminates the error.

Code Example 2

f% = 20
q = 7
w5% = 1
ax = 1
scal = 20 * (4.666 * w5% / ax)
x1% = 95
fb = 50.967
fsd = 33
a = fb ^ 2 / fsd ^ 2
qtsd = .26
b = (a / qtsd) + (fb / (q * fsd))
vasd = 3
nd% = 1
vb = .738
c = 1 + a + (fb / (q * fsd * qtsd)) + (vasd * nd% / vb)
d = (1 / qtsd) + (fb / (q * fsd))
frq = f% / fsd
y1=frq^4 / (((frq^4 - c*frq^2 + a)^2 + (b * frq - d * frq^3)^2)^.5)
				
The last line in this example also gives an "illegal function call" under the same circumstances as Example 1 in this article.

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB66560