supplierdeeply

can't get this to work on ubasic; don't know why?

  • 6 Replies
  • 1150 Views
can't get this to work on ubasic; don't know why?
« on: 04 / February / 2015, 20:27:44 »
Advertisements
this program gives an error on line 20; also, it doesn't follow line by line while walking through the if then else portion. can someone help me? my e-mail is leavemsg1(at)gmail.com; I'm not sure if I will be able to find my way back to this forum. thanks in advance with any/all help; this program works very well in qbasic, but I need to use ubasic. thanks.

10 CLS

12 INPUT N

14 IF SQRT(N) = INT(SQRT(N)) THEN

16   PRINT SQRT(N)

18 ELSE

20   D = .576129365#: E = 2 * INT(LOG(N)/LOG(10))

22   M1 = N ^ D

24   M2 = M1 ^ EXP(1)

26   FOR I = 1 TO E

28     M3 = INT(D * I * M2)

30     FOR J = -E TO E

32       Z1 = N: Z2 = M3 + J: Z3 = 1

34       IF Z1 > Z2 THEN TMP = Z1: Z1 = Z2: Z2 = TMP

36       WHILE (Z3 <> 0)

38         Z3 = Z1 MOD Z2: Z1 = Z2: Z2 = Z3

40       WEND

42       IF Z1 > 1 AND Z1 < N THEN

44         PRINT Z1: I = E: J = E

46       END IF

48     NEXT J

50   NEXT I

52 END IF

54 GOTO 12


Bill ~~~~

Re: can't get this to work on ubasic; don't know why?
« Reply #1 on: 04 / February / 2015, 20:40:55 »
Assuming this is not a troll / joke,  why would you think a QBASIC script would run in uBASIC? 

I don't even know where to begin with what is wrong with this but the line numbers might be a good start?  uBASIC does not use them.  And line 20 is trying to use floating point numbers,  not supported by uBASIC.  It also does not support the INPUT function.  It goes on from there ....

You might want to start here if you are serious about this :  CHDK Scripting Cross Reference Page   There is a lot of good reference material there.

Or you could tell us what you are actually trying to do with this script and we might be able to help you from there?

As far as you gmail account goes,  we offer help in this forum and respond here so that others can learn too.  If you can't find your way back here, that is unfortunate.


« Last Edit: 04 / February / 2015, 20:57:33 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: can't get this to work on ubasic; don't know why?
« Reply #2 on: 04 / February / 2015, 20:53:18 »
it isn't a joke. thanks. no line numbers. no floating point numbers. and no INPUT. ok... thanks!

Re: can't get this to work on ubasic; don't know why?
« Reply #3 on: 04 / February / 2015, 20:58:33 »
it isn't a joke. thanks. no line numbers. no floating point numbers. and no INPUT. ok... thanks!
I said that was the starting point.  There may be other things wrong,  I stopped looking at that point.

What are you trying to do here - might be easier to help if you shared that.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: can't get this to work on ubasic; don't know why?
« Reply #4 on: 04 / February / 2015, 21:18:10 »
I'm in the wrong forum. I wanted the UBasic written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing.

Re: can't get this to work on ubasic; don't know why?
« Reply #5 on: 04 / February / 2015, 21:22:39 »
I'm in the wrong forum. I wanted the UBasic written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing.
Yup - you are most definitely in the wrong forum.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11487
Re: can't get this to work on ubasic; don't know why?
« Reply #6 on: 04 / February / 2015, 21:41:42 »
Yes, our ubasic is derived from http://dunkels.com/adam/ubasic/ by Adam Dunkels
Don't forget what the H stands for.

 

Related Topics