No values when compiling with -lang fblite

New to FreeBASIC? Post your questions here.
Rota
Posts: 5
Joined: Jun 14, 2015 14:20

No values when compiling with -lang fblite

Postby Rota » Nov 06, 2015 9:24

This is a short QB program which I compiled using -lang fblite:

Code: Select all

sum = 0
for i = 1 to 10
  j = (25/37)^(i-1)*(12/37)
   print using "#.#####"; j
   sum = sum + j
next i
print sum


However, the output is all zeros:

0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0.00000
0

When I compile with -lang qb the output is correct. But I thought fblite allowed variables to be implicitly declared? or is that not the problem?

The odd thing is, when I use the floating point suffix (#) then the program does produce the correct output when compiled with fblite:

Code: Select all

sum# = 0
for i = 1 to 10
  j# = (25/37)^(i-1)*(12/37)
   print using "#.#####"; j#
   sum# = sum# + j#
next i
print sum#


0.32432
0.21914
0.14807
0.10004
0.06760
0.04567
0.03086
0.02085
0.01409
0.00952
0.9801672541740861

Confused...

The manual isn't very clear about what's allowed with fblite, it just says anything allowed in version 0.16b, but where do I find what that actually is?

Thanks in advance for any help.
RockTheSchock
Posts: 226
Joined: Mar 12, 2006 16:25

Re: No values when compiling with -lang fblite

Postby RockTheSchock » Nov 06, 2015 12:51

Standard Datatype QB is SINGLE while with FBLite it's Integer

You just need insert as first line:
DefSng A-Z
Rota
Posts: 5
Joined: Jun 14, 2015 14:20

Re: No values when compiling with -lang fblite

Postby Rota » Nov 06, 2015 15:03

Thanks RTS!

Return to “Beginners”

Who is online

Users browsing this forum: MSN [Bot] and 2 guests