Dr_Davenstein
|
 |
« Reply #15 on: March 06, 2005, 07:39:23 PM » |
|
Moneo, why don't you want to use an IDE? I've found Von Godric's FB-IDE to be more than ample. 
|
|
|
Logged
|
|
|
|
thegrogen
|
 |
« Reply #16 on: March 06, 2005, 09:32:54 PM » |
|
Moneo, why don't you want to use an IDE? I've found Von Godric's FB-IDE to be more than ample.
Exactly. Oh, and, if the compiler is command line, it means that you have to run it from DOS, otherwise you won't be able to specify stuff. It's not that hard, once you get used to it. And it isn't a DOS application, actually. It's a WIN32 console application, which means that it won't run on standalone DOS. It has to have Windows with it. So that's why if you do PRINT in your programs without doing SCREEN first, it opens a DOS window  .
|
|
|
Logged
|
.14159265358979323846264338327950288419716939937510582709445 Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
|
|
|
Moneo
|
 |
« Reply #17 on: March 06, 2005, 10:41:21 PM » |
|
If there is "win32" in the name of the file you downloaded, it's the Windows version. Even the Windows version of fbc.exe is text only, like a DOS program.
Here's an alternative way to use it: 1. create a .bas file 2. drag the .bas file on to fbc.exe an exe should appear.
The problem with this method is that if fbc couldn't compile it for some reason, you won't know why. Normally it would PRINT something to explain what's wrong, but you won't see that.
To use it properly (and not miss out on error messages) you're going to need either an IDE or the command prompt. Sterling, Yes the name of the zip file was: freeBAsic-v0.11b-win32.zip I agree that the alternate way to compile is no good. Ok, so how do I get into the IDE? As always, Sterling, I appreciate your help. *****
|
|
|
Logged
|
|
|
|
Moneo
|
 |
« Reply #18 on: March 06, 2005, 10:53:33 PM » |
|
Moneo, why don't you want to use an IDE? I've found Von Godric's FB-IDE to be more than ample.
Exactly. Oh, and, if the compiler is command line, it means that you have to run it from DOS, otherwise you won't be able to specify stuff. It's not that hard, once you get used to it. And it isn't a DOS application, actually. It's a WIN32 console application, which means that it won't run on standalone DOS. It has to have Windows with it. So that's why if you do PRINT in your programs without doing SCREEN first, it opens a DOS window  . DR., I have had bad experiences with IDE's. When something doesn't work right, you don't know if it's your program or some weirdness in the IDE. THEGROGEN, * Can I compile and get an executable using the IDE? Or will I have to run in emulation mode, which I don't want? * By using the IDE, can I avoid MSDOS and the command-line alltogether? * About doing a PRINT command: does that mean that the PRINT doesn't work like in normal Basic? What kind of a SCREEN command are you referring to? Thanks. *****
|
|
|
Logged
|
|
|
|
Dr_Davenstein
|
 |
« Reply #19 on: March 06, 2005, 11:13:08 PM » |
|
This is the newest version of the IDE, plus the newest version of the compiler... http://www.hot.ee/fbide/FBIde33a+FBC012.exeI have found 0 critical faults with this package... unless it was my fault, but that doesn't count! :lol:
|
|
|
Logged
|
|
|
|
Moneo
|
 |
« Reply #20 on: March 06, 2005, 11:22:44 PM » |
|
Thanks, Dr., I'll try it. *****
|
|
|
Logged
|
|
|
|
Sterling Christensen
|
 |
« Reply #21 on: March 06, 2005, 11:26:50 PM » |
|
* Can I compile and get an executable using the IDE? Or will I have to run in emulation mode, which I don't want?
* By using the IDE, can I avoid MSDOS and the command-line alltogether? Yes, the IDE will pass the bas file to fbc.exe for you, report any errors, and even run the program for you. No emulation required: The IDE, fbc.exe, and the exes generated by fbc.exe will all be regular 32 bit Windows programs. Yes, you can avoid MSDOS altogether, and you won't have to use any command prompt.
|
|
|
Logged
|
|
|
|
Moneo
|
 |
« Reply #22 on: March 07, 2005, 12:16:04 AM » |
|
STERLING, Thanks for the good info. DR., I downloaded the IDE stuff you provided, ran the setup, and tested the little program (written by Neo) at the bottom of this post. It runs, but doesn't always give the right answers. Examples: Value of 9, base of 3, answer is 2 (correct) Value of 27, base of 3, answer is 3 (correct) Value of 125, base of 5, answer is -1 (error, should be 3, which it gives when run under DOS). Is there any good reason for this? Is the program using something that is not supported by FB? ***** rem Neo's Power-of solution
DECLARE FUNCTION GetExponent%(Value AS INTEGER, BaseValue AS INTEGER)
'/******************************************************************** ' Calculates and returns the integer exponent of BaseValue^x=Value, ' if it exists, in which x is a positive integer number in I. ' Value and BaseValue are required to be postive integer numbers ' Returns -1 if the exponent doesn't exist ' The parameters and return value all span I-positive < 32767 ' ********************************************************************/
dim v as integer dim b as integer
print "Enter the value"; input v print "Enter the base"; input b
print GetExponent(v,b)
input x 'For running in FB to see the output.
system
END
FUNCTION GetExponent(Value AS INTEGER, BaseValue AS INTEGER) ' /***************************************************** ' Exclude some general mathematical exceptions to LOG ' *****************************************************/ IF BaseValue = 1 AND Value <> 1 THEN GetExponent = -1: EXIT FUNCTION ELSEIF (BaseValue = 1 AND Value = 1) OR (BaseValue = 0 AND Value = 0) THEN GetExponent = 1: EXIT FUNCTION ELSEIF (Value = 0 AND BaseValue <> 0) THEN GetExponent = -1: EXIT FUNCTION END IF IF BaseValue < 1 OR Value < 0 THEN GetExponent = -1: EXIT FUNCTION END IF
'/********************************** ' Calculate the exponent required ' **********************************/ Exponent# = LOG(CDBL(Value)) / LOG(CDBL(BaseValue))
'/********************************************************** ' See if it is an integer exponent and return it if it is ' **********************************************************/ IF Exponent# = INT(Exponent#) THEN GetExponent = INT(Exponent#) ELSE GetExponent = -1 END IF END FUNCTION
|
|
|
Logged
|
|
|
|
dumbledore
|
 |
« Reply #23 on: March 07, 2005, 02:04:52 AM » |
|
changed exponent# to exponent! and took out the cdbl's and it worked perfectly. doubles are evil for seeing if they're whole numbers, and they're more precision than you need anyway if all you're doing anyway since you only use the value if it's a whole number.
|
|
|
Logged
|
ttp://m0n573r.afraid.org/ quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side ...phear
|
|
|
dumbledore
|
 |
« Reply #24 on: March 07, 2005, 02:08:37 AM » |
|
or, here's a way to keep the double precisions. FUNCTION GetExponent(Value AS INTEGER, BaseValue AS INTEGER) ' /***************************************************** ' Exclude some general mathematical exceptions to LOG ' *****************************************************/ IF BaseValue = 1 AND Value <> 1 THEN GetExponent = -1: EXIT FUNCTION ELSEIF (BaseValue = 1 AND Value = 1) OR (BaseValue = 0 AND Value = 0) THEN GetExponent = 1: EXIT FUNCTION ELSEIF (Value = 0 AND BaseValue <> 0) THEN GetExponent = -1: EXIT FUNCTION END IF IF BaseValue < 1 OR Value < 0 THEN GetExponent = -1: EXIT FUNCTION END IF
'/********************************** ' Calculate the exponent required ' **********************************/ Exponent# = LOG(Value) / LOG(BaseValue)
'/********************************************************** ' See if it is an integer exponent and return it if it is ' **********************************************************/ IF int(BaseValue ^ INT(Exponent#)) = Value THEN GetExponent = INT(Exponent#) ELSE GetExponent = -1 END IF END FUNCTION
|
|
|
Logged
|
ttp://m0n573r.afraid.org/ quote: "<+whtiger> you... you don't know which way the earth spins?" ... see... stupidity leads to reverence, reverence to shakiness, shakiness to... the dark side ...phear
|
|
|
v3cz0r
|
 |
« Reply #25 on: March 07, 2005, 01:59:32 PM » |
|
Floating-point numbers should never be compared for equality, at least use an epsilon: http://teaching.idallen.com/cst8110/97s/floating_point.html . FB will leave the floating-point operands in the FPU stack (80-bit precision) when possible, while in QB all functions returning floats had to store the results on vars (the hidden argument), where you have max 64 bits with DOUBLE's.
|
|
|
Logged
|
|
|
|
Moneo
|
 |
« Reply #26 on: March 09, 2005, 12:21:05 AM » |
|
Thanks, Dumbledore.
So what's the tip regarding using "double" in FB? Are you saying that it should not be used? *****
|
|
|
Logged
|
|
|
|
v3cz0r
|
 |
« Reply #27 on: March 09, 2005, 12:30:01 AM » |
|
Where did you get that idea?
I said, comparing floating-point numbers for EQUALITY is not recommended in ANY language.
|
|
|
Logged
|
|
|
|
Moneo
|
 |
« Reply #28 on: March 12, 2005, 10:27:41 PM » |
|
V3czOr,
Ok, ok, I get your point. After thinking about it, you're right, comparing floating point numbers for equality is risky and should be avoided.
I originally thought that it was a FB incompatibility. In the case of this little program, the floating point problem did not manifest itself in Qbasic, but in FB it did. Thanks. *****
|
|
|
Logged
|
|
|
|
Moneo
|
 |
« Reply #29 on: April 07, 2005, 11:13:24 PM » |
|
Well, here I am 4 weeks later. With the great help from you guys, and your patience with me, I finally accomplished what I intended to do using FB, which is: * Write a program in QB. * Compile it at home with FB, and test it. * Take it into work and install on a PC which does not allow MSDOS nor any 16 bit programs. * EUREKA!!! The son-of-a-gun runs like a charm. :bounce:
The people at work thought I was crazy when I told them what I was gonna do. Now they're believers when they saw it run.
FB could start a revolution. All us old QB or QuickBasic programmers that were laughed at for using Basic and MSDOS, can now have the last laugh.
Thanks again to you guys. *****
|
|
|
Logged
|
|
|
|
|