Whats in next version?

Everything else that doesn't fall into one of the other PB categories.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Whats in next version?

Post by Dreglor »

im wondering whats planned in the next version :)
~Dreglor
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Nobody will tell ya 8O
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

It comes with a thousand monkeys who will code your app or game for you!!! :lol:

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

WOW THAT MUST BE THE BEST FEATURE EVER!

(but seriosly what is upcomming in the next version)
~Dreglor
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

I hope better floats.
Look at this example:

Code: Select all

;The following text is from:
;
;http://www.linuxgazette.com/node/view/3744
;
;May Functions
;
;These functions build up a series of terms with the form: 
;
;x0 is given in [0;1]
;xk+1 = mu.xk.(1 - xk) where mu is a parameter
;
;They were introduced by Robert May in 1976, To study the evolution of a closed insect population. It can be shown that:
;
;  * For 0 <= mu < 3, the behaviour of the series is deterministic 
;  * For 3 <= mu <= 4, behaviour is chaotic 
;Simplifying things somewhat, the difference between a chaotic And a deterministic system is their sensibility To initial conditions. A chaotic system is very sensible: a small variation of the initial value of x0 will lead To increasing differences in subsequent terms. Thus any error that creeps into the calculations -- such as lack of precision -- will eventually give very different final results.
;
;Other examples of chaotic systems are satellite orbitals And weather prediction.
;
;On the other hand, a deterministic system is not so sensible. A small error in x0 will make us calculate terms that, While differing from their exact value, will be "close enough" aproximations (whatever that means).
;
;An example of a deterministic system is the trajectory of a ping-pong ball.
;
;So chaotic functions are useful To test the precision of calculations on different systems And with various compilers.
;
;Our example
;
;In this example, I propose To use the following values:
;
;mu = 3.8
;x0 = 0.5
;
;A precise calculation with a special 1000-digit precision packet gives the following results:
;          k              x(k)
;         -----          ---------
;           10            0.18509
;           20            0.23963
;           30            0.90200
;           40            0.82492
;           50            0.53713
;           60            0.66878
;           70            0.53202
;           80            0.93275
;           90            0.79885
;          100            0.23161
;
;As you see, the series fluctuates merrily up and down the scale between 0 and 1.

;the PureBasic test program:

;  float.f = 0.500000;
;  Debug "k       X(k)";
;  For k = 1 To 100
;    float = 3.800000 * float * (1.000000 - float);
;    If (k % 10 = 0) 
;      Debug Str(k) + "   " + StrF(float);
;    EndIf
;  Next
 
;now to the results with PB 32bit and special 64bit functions...
;first some provedures for the 64bit functions
Structure r10
  StructureUnion
    fword.w[5]
    tbyte.b[10]     
  EndStructureUnion
EndStructure

Procedure r10copy(*x.r10,*y.r10);x=y
   *x\fword[4]=*y\fword[4]
   *x\fword[3]=*y\fword[3]
   *x\fword[2]=*y\fword[2]
   *x\fword[1]=*y\fword[1]
   *x\fword[0]=*y\fword[0]
EndProcedure

Procedure r10add(*x.r10,*y.r10,*z.r10);x=y+z
  FINIT
  MOV ebx,*z
! fld tword [ebx]
  FST st1
  MOV ebx,*y
! fld tword [ebx]
  FADD st0,st1
  MOV ebx,*x
! fstp tword [ebx]
EndProcedure

Procedure r10int(*x.r10,*y.r10) ;x=int(y)
  MaskedCW.l
  mcw.l=@MaskedCW.l
  SaveCW.l
  scw.l=@SaveCW.l
  FINIT
  MOV ebx,mcw
! fstcw [ebx]
  SaveCW=MaskedCW
  MaskedCW=MaskedCW|%010000000000;round toward -inf
  MOV ebx,mcw
! FLDCW [ebx]
  MOV ebx,*y
! fld tword [ebx]
  FRNDINT
  MOV ebx,*x
! fstp tword [ebx]
  MOV ebx,scw
! fldcw [ebx]
EndProcedure

Procedure r10power(*x.r10,e.w);x=x^e.w ie integer power
;this proc is only used by r10atof() and r10ftoa()
;x must be an address of a r10 variable
e1.w=Abs(e)
;take x To an integer power
FINIT
FLD1 ;  z:=1.0
FST st1
MOV ebx,*x
! fld tword [ebx];load st0 with x
While e1>0
   While (e1&1)=0;while e is even
     e1=e1 >> 1;e1=e1/2
     FMUL st0,st0;x=x*x
   Wend
   e1=e1-1
   FMUL st1,st0;z=z*x ;st1=st1*st0
Wend
FXCH st1;exchange st0 and st1
If e<0;if power is negative, take reciprocal
!   FLD1
!   FDIV st0,st1
EndIf
MOV ebx,*x
! fstp tword [ebx];store z (st0) into x
EndProcedure


Procedure r10atof(*x.r10,afloat$);string to r10 var x
;afloat should be string representation of valid number
tenx.r10
tenxptr=@tenx
ten.l=10
tenptr=@ten
f1$=UCase(afloat$)
f$=""
;
;remove invalid chars
For i=1 To Len(f1$)
   a=Asc(Mid(f1$,i,1))
   If (a>47 And a<58) Or a=69 Or a=46 Or a=45
     f$=f$+Chr(a)
   EndIf
Next i
;
;separate mantissa and exponent
p=FindString(f$,"E",1)
If p>0
   e$=Right(f$,Len(f$)-p)
   f$=Trim(Left(f$,p-1))
Else
   e$="0"
   f$=Trim(f$)
EndIf 
;
;remove sign of mantissa
If Left(f$,1)="+"
   f$=Right(f$,Len(f$)-1)
   s=0
ElseIf Left(f$,1)="-"
   f$=Right(f$,Len(f$)-1)
   s=-1
EndIf
;
;add decimal point to mantissa if missing
p=FindString(f$,".",1)
If p=0: f$=f$+".0": EndIf
;
;remove leading zeros before mantissa decimal point
i=0
Repeat: i=i+1: Until Mid(f$,i,1)<>"0"
f$=Right(f$,Len(f$)-i+1)
;
;if mantissa <0 remove leading zeros after decimal point
ex.w=0
If Left(f$,1)="."
   i=1
   Repeat: i=i+1: Until Mid(f$,i,1)<>"0" Or i>Len(f$)
   f$=Right(f$,Len(f$)-i+1)
   ex.w=2-i
EndIf
;
;create 18 decimal digit mantissa and exponent word
p=FindString(f$,".",1)
a$=Left(f$,p-1)
b$=Right(f$,Len(f$)-p)
ex=ex+Len(a$)+Val(e$);exponent
f1$=a$+b$
While Len(f1$)<18: f1$=f1$+"0": Wend
If Len(f1$)>18
   l.w=Len(a$)
   f1$=Left(f1$,18)
EndIf
;example of variables so far:
;if string was "-.00000000001234e-33"
;then f1 would now hold; "123400000000000000",  s=-1 (sign)
;ex now holds -43  ie exponent as in 0.1234e-43
;
;we now convert f1$ to a packed BCD number and store
;it in *x, then divide *x by 10^(18-ex).
*x\tbyte[9]=0 ;alway zero for positive BCD number
i=1
j=8
While i<18
   c.w=16*(Asc(Mid(f1$,i,1))-48)
   i=i+1
   c.w=c+(Asc(Mid(f1$,i,1))-48)
   i=i+1
   *x\tbyte[j]=c
   j=j-1
Wend
;now divide number by 10^x to get proper float
ex=18-ex
FINIT
MOV ebx,tenptr;load 10 into ebx
! fild word [ebx];load int at *ebx and convert to float in st0
MOV ebx,tenxptr;load address of tenx into ebx
! fstp tword [ebx];store float 10 into tenx
r10power(@tenx,ex);raise tenx to ex power
FINIT
MOV ebx,tenxptr
! fld tword [ebx];load tenx^ex into st0
FST st1;store into st1
MOV ebx,*x
! fbld tword [ebx];
;fbld converts the packed BCD integer into double extended precision
;floating point format and pushes this value onto the FPU stack
FDIV st0,st1 ;the number is divided by tenx^ex
If s=-1 ;if number sign was '-' then change the sign in float
!   FCHS
EndIf
MOV ebx,*x
! fstp tword [ebx] ;put float into *x
EndProcedure

Procedure r10mul(*x.r10,*y.r10,*z.r10);x=y*z
  FINIT
  MOV ebx,*z
! fld tword [ebx]
  FST st1
  MOV ebx,*y
! fld tword [ebx]
  FMUL st0,st1
  MOV ebx,*x
! fstp tword [ebx]
EndProcedure

Procedure.s r10ftoa(*x.r10,format.l)
;convert r10 float to string
;
;FORMAT OPTIONS
;format=0          original tejon format
;format=19         fixed length scientific format
;format=1 to 18    output rounded to give 1 to 18 sig figs 
;format=-1 to -40  output rounded to give 1 to 40 decimal places
;
xtem.r10
r10copy(@xtem,*x);save *x because bcd pack uses it
z.w=*x\fword[4]
zz.w=*x\fword[3]
If (format<-40) Or (format>19):format=19:EndIf
If (z=0) And (zz=0)
   If format=0
     f$="0.00000000000000000"
   ElseIf format=19
     f$="+0.00000000000000000e+0000"
   ElseIf format>0
     f$="0"
   Else
     f$=LSet("0.",2-format,"0")
   EndIf
   ProcedureReturn f$
EndIf
bex.w=(*x\fword[4]&%111111111111111)-$3ffe
s.w=*x\fword[4]>>15
ex.w=Int(0.30103*bex);initial guess at decimal exponent
exp=@bex
ex1.w=17-ex
tenx.r10
tenxptr=@tenx
t.l=10
tptr=@t
FINIT
MOV ebx,tptr ;load 10 into ebx
! fild word [ebx] ;load integer 10, convert to float in st0
MOV ebx,tenxptr ;load address of tenx into ebx
! fstp tword [ebx] ;store float 10 into tenx
r10power(@tenx,ex1) ;raise tenx to ex power
FINIT
MOV ebx,tenxptr
! fld tword [ebx] ;load tenx^ex into st0
FST st1 ;store into st1
MOV ebx,*x
! fld tword [ebx];
FMUL st0,st1 ;the number is multiplied by tenx^ex
FST st1
! fbstp [ebx] ;BCD pack float into *x
;multiply *x by 10 if most sig BCD digit is zero
;this happens when next BCD digit is 8 or 9
If (*x\tbyte[8]&$ff)<10
!  FST st1
   MOV ebx,tptr ;load 10 into ebx
! fild word [ebx] ;load integer 10, convert to float in st0
   FMUL st0,st1
   ex=ex-1
EndIf
If s=-1 ;if number -ve then change the sign in float
;   FCHS ; not needed
EndIf
MOV ebx,*x
! fbstp tword [ebx] ;BCD pack float into *x
c.w=*x\tbyte[8]&$ff
h.w=c>>4
l.w=c-h<<4
If l>10;FBSTP value for FPU exception
   f$="INVALID"
   If format=19:f$=f$+Space(19)+"":EndIf
   ProcedureReturn f$
EndIf
i=8
While i>=0;load 18 digit mantissa to f$
   c.w=*x\tbyte[i] & $ff
   h.w=c>>4
   l.w=c-h<<4
   f$=f$+Chr(h+48)+Chr(l+48)
   i=i-1
Wend
;
;create output string using 18 digits in f$, s and ex
If format=0;tejon format
   f$=Left(f$,1)+"."+Right(f$,Len(f$)-1)
   If Abs(ex)>0: f$=f$+"e"+Str(ex): EndIf
   If s=-1: f$="-"+f$:EndIf
ElseIf format=19;fixed length scientific format
   f$=Left(f$,1)+"."+Right(f$,Len(f$)-1)
   If ex<0
     a$="e-"+ RSet(Str(-ex),4,"0")
   Else
     a$="e+"+ RSet(Str(ex),4,"0")
   EndIf
   f$=f$+a$
   If s=-1
     f$="-"+f$
   Else
     f$="+"+f$
   EndIf
ElseIf format<0;fixed decimal digit format
   d=ex+1-format;number of digits of f$ that will be used
   If d<=0
     f$=""
   ElseIf d<18;need to round number to digits needed
     a$=Left(f$,d);create integer string
     a$=a$+"."+Mid(f$,d+1,1);add digit to be rounded
     tem.r10
     tem2.r10
     r10atof(@tem,a$)
     r10atof(@tem2,"0.5")
     r10add(@tem,@tem,@tem2);add 0.5
     r10int(@tem2,@tem);and take int, ie round
     b$=r10ftoa(@tem2,19);re-entrant call to this procedure
;    this is OK because format 19 won't re-enter again     
     If Mid(b$,2,1)="1" And Left(a$,1)="9"
       d=d+1;one more digit eg 9.999 rounded to 10.000
     EndIf
     f$=Mid(b$,2,1)+Mid(b$,4,d-1);rounded digits
   Else;d>=18 so need to add extra digits
     f$=LSet(f$,d,"0")
   EndIf
   If d<=-format;no digits before decimal
     f$=RSet(f$,-format,"0");add leading zeros after decimal
     f$="0."+ f$
   Else;digits before decimal
     f$=Left(f$,d+format)+"."+Right(f$,-format)
   EndIf
   If s=-1: f$="-"+f$:EndIf
ElseIf format>0;significant figures format
   If format<18;need to round to digits needed
     a$=Left(f$,format);create integer string
     a$=a$+"."+Mid(f$,format+1,1);add digit to be rounded
     tem.r10
     tem2.r10
     r10atof(@tem,a$)
     r10atof(@tem2,"0.5")
     r10add(@tem,@tem,@tem2);add 0.5
     r10int(@tem2,@tem);and take int, ie round
     b$=r10ftoa(@tem2,19);re-entrant call to this procedure
;    this is OK because format 19 won't re-enter again     
     If Mid(b$,2,1)="1" And Left(a$,1)="9"
       ex=ex+1;one more digit eg 9.999 rounded to 10.000
     EndIf
     f$=Mid(b$,2,1)+Mid(b$,4,format-1);rounded digits
   EndIf
   If ex>8 Or ex<-3
     f$=Left(f$,1)+"."+Right(f$,Len(f$)-1)
     f$=f$+"e"+Str(ex)
   ElseIf ex<0
     f$="0."+RSet(f$,Len(f$)-1-ex,"0")
   Else;ie ex 0 to 8
     a$=f$+"00000000"
     a$=Left(a$,ex+1)
     If format>(ex+1)
       a$=a$+"."+Mid(f$,ex+2,format-ex-1)
     EndIf
     f$=a$
   EndIf
EndIf
r10copy(*x,@xtem);restore *x after use by bcd pack
ProcedureReturn f$
EndProcedure

Procedure r10sub(*x.r10,*y.r10,*z.r10);x=y-z
  FINIT
  MOV ebx,*z
! fld tword [ebx]
  FST st1
  MOV ebx,*y
! fld tword [ebx]
  FSUB st0,st1
  MOV ebx,*x
! fstp tword [ebx]
EndProcedure

;main function
  
  ;this if for PB calculation
  float.f = 0.500000

  ;this is for R10 64bit calculation
  v.r10
  w.r10
  x.r10
  y.r10
  z.r10
  r10atof(@v,"3.800000")
  r10atof(@y,"1.000000")
  r10atof(@z,"0.500000")
  
  ;calculations and output
  Debug "#         correct       special     PureBasic";
  Debug "k          value           64bit            32bit";
  Debug "------------------------------------------------------";

  For k = 1 To 100

    float = 3.800000 * float * (1.000000 - float);

    r10sub(@x,@y,@z)
    r10mul(@w,@z,@x)
    r10mul(@z,@v,@w)

    If (k % 10 = 0) 
      If k = 10 : Debug Str(k) + "      " + "0.18509" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 20 : Debug Str(k) + "      " + "0.23963" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 30 : Debug Str(k) + "      " + "0.90200" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 40 : Debug Str(k) + "      " + "0.82492" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 50 : Debug Str(k) + "      " + "0.53713" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 60 : Debug Str(k) + "      " + "0.66878" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 70 : Debug Str(k) + "      " + "0.53202" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 80 : Debug Str(k) + "      " + "0.93275" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 90 : Debug Str(k) + "      " + "0.79885" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      ElseIf k = 100 : Debug Str(k) + "    " + "0.23161" + "     " + r10ftoa(@z,-6) + "     " + StrF(float);
      EndIf
    EndIf
  Next

End
With this code PureBasic looses the connection to "real results" already at k=40 8O

BTW: you have to enable INLINE ASM
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Fred posted in a few places on these forums concerning the next version(s), aka roadmap. (do a search on "fred"). Anyways, one of the things is syncing all versions of PB together before the big 4.0 version.

So I believe...

All four versions will be in sync sometime soon (1st or 2nd quarter next year?). This means Linux and Amiga will finally be feature complete (when compared to the windows version), and the OSX version will as well :) Which is very big news for everybody !! :)

One of the big linux hurdles Fred was having trouble on in the past with the linux version is the 3dsprite library (that is currently missing from linux). There was just no easy equivilent in Linux, other then emulating through OpenGL. :( But, that'll be fullfilled before 4.0 :)

The first version of OSX you can find in the announcement forum is a HUGE announcement. It shows the power of PB starting for the OSX. This is fricken huge.

The good thing about once 4.0 rolls around, you should be able to actually produce cross-platform native PB code w/o workarounds. Once this happens, PB would be able to compete with the likes of RealBasic, Gamas, Phoenix Basic, ExtremeBasic and the like.

And once Floats are implimented.. whee!

Anyways, much to look foward to!
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

I hope that purebasic will get a RAD(Rapid Application Development) environment IDE, same as object-oriented IDE, like REALBasic and VB.NET has.
Look here: http://basic.mindteq.com/
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

http://basic.mindteq.com/ wrote:if the IDE had been a RAD environment Purebasic would have been the best Basic-like compiler.
Bonne_den_kule wrote:I hope that purebasic will get a RAD(Rapid Application Development) environment IDE, same as object-oriented IDE, like REALBasic and VB.NET has.
See: viewtopic.php?t=10453 :D
--Kale

Image
BasicGuy
User
User
Posts: 70
Joined: Sat Apr 26, 2003 4:37 am
Location: US

Post by BasicGuy »

Shannara said:
One of the big linux hurdles Fred was having trouble on in the past with the linux version is the 3dsprite library (that is currently missing from linux). There was just no easy equivilent in Linux, other then emulating through OpenGL.
Actually, I'd like to see that happen for all supported platforms anyway. It's not much of a trick to do textured polys for sprites. The biggest challenge is the collision code. :wink:
Post Reply