Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strange INPUT behavior
#1
This must be a newbish question, but I've been using FB just for a few days, and can't find a solution.

Whenever I write something like this:

Code:
INPUT a,b,c
PRINT a,b,c

and type numbers, say, 1, 2.8, 5, I get printed 1, 2, 5, i.e., the fraction is lost somewhere. FB documentation tells there is no difference from QB, but in QB this works just as it should. I'm using the latest version of FB, 0.14. What am I doing wrong?
Reply
#2
the difference is that qb defaults to the Single data type, which allows for fractions of numbers. FB however, defaults to qb's "long" data type (modern integer, 32 bits) so the decimal is cut off in order to fit into the integer.

you can either DIM the variables the way you need them, or, to make FB default to Singles, like QB, add

Code:
DefSng A-Z

to the top of your code :)
Reply
#3
I just hit reply, and see you beat me too it cha0s, by seconds!
Reply
#4
This saved my day, thank you!
Reply
#5
anytime
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)