Hi,

I am looking for help again. Here is my code:

#COMPILE EXE

#DIM ALL

FUNCTION PBMAIN () AS LONG

DIM arr(18) AS LONG

DIM i AS LONG

solution(SQR(7),arr())

FOR i = 0 TO 17

PRINT STR$(arr(i))+" ";

NEXT i

WAITKEY$

END FUNCTION

FUNCTION solution(x AS DOUBLE,arr() AS LONG)AS LONG

DIM k AS LONG, a AS LONG

DIM y AS DOUBLE

FOR k = 0 TO 17

a = INT(x)

arr(k) = a

y = x - a

IF y = 0 THEN

GOSUB endit

ELSE

x = 1/y

END IF

NEXT k

endit:

END FUNCTION

The result is correct but the time is not! Has anyone an idea to make it faster?

kind regards

Volker

I am looking for help again. Here is my code:

#COMPILE EXE

#DIM ALL

FUNCTION PBMAIN () AS LONG

DIM arr(18) AS LONG

DIM i AS LONG

solution(SQR(7),arr())

FOR i = 0 TO 17

PRINT STR$(arr(i))+" ";

NEXT i

WAITKEY$

END FUNCTION

FUNCTION solution(x AS DOUBLE,arr() AS LONG)AS LONG

DIM k AS LONG, a AS LONG

DIM y AS DOUBLE

FOR k = 0 TO 17

a = INT(x)

arr(k) = a

y = x - a

IF y = 0 THEN

GOSUB endit

ELSE

x = 1/y

END IF

NEXT k

endit:

END FUNCTION

The result is correct but the time is not! Has anyone an idea to make it faster?

kind regards

Volker

## Comment