I hold freebasic V 0.4.6, 19 feb 2006.
In a version elder than this it was possible to print result in exponential form, but somebody has been too smart and has removed
this ability from the program. WHY??
At that time the programming could look like: LPRINT "##.###^^^^"; x, and the result looked something like: 1.234E+03.
Do you have an easy solution. Do suggest up-dating. That I am not doing, as freebasic is not backward compatible, because
it would means I had to re-write more than 150 programs. A solution must not fort new program!
Yours sincerely
Niels Olsen
Printing result in exponential form
-
- Posts: 29
- Joined: May 28, 2006 18:32
- Location: denmark
Re: Printing result in exponential form
0.4.6 is not a freeBasic compiler version. It is a FBIDE version.
Also, I don't think that has been removed from the compiler.
https://www.freebasic.net/wiki/KeyPgLprint
It looks like you need to use "Using" with LPRINT to get that.
Also, I don't think that has been removed from the compiler.
https://www.freebasic.net/wiki/KeyPgLprint
It looks like you need to use "Using" with LPRINT to get that.
Re: Printing result in exponential form
Perhaps something like
Code: Select all
#lang "fblite"
#include "crt.bi"
dim as zstring * 50 s
for n as long=1 to 20
sprintf(@s,"%e",rnd*1000-rnd*1000)
lprint s
next
print "done, press a key to print"
sleep
Re: Printing result in exponential form
No not quite. You forgot the "USING" keyword there. Without the USING keyword you will not get exponent number display with QB or FB.niels olsen wrote: ↑Mar 24, 2023 16:48At that time the programming could look like: LPRINT "##.###^^^^"; x, and the result looked something like: 1.234E+03.
Exponential number formatting is certainly still in FB, and it is in all dialects. It's done the same way it has always been done with "LPRINT USING" or "PRINT USING."
https://www.freebasic.net/wiki/KeyPgPrintusing
Also the FBLite dialect that you are likely using is still supported in the latest version, so your old code should compile and run just fine if you make sure to tell the compiler to use fblite. QB dialect is also still supported.