Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The L-BASIC compiler
#26
hello luke
you said that L-Basic is broken, nonetheless I would like to report my findings
the following works
Code: (Select All)
dim as integer i
dim as integer x

x=13
i=10*(x+1)
print i

but not this
Code: (Select All)
dim as integer i
dim as integer x

x=13
i=10*(10*(x+1))
print i
Quote:Both operands to a binary operator are not of the same type!
  %mul2 = mul i32 10, i16 %mul
LLVM ERROR: Broken function found, compilation aborted!
Compilation failed.
array in user defined functions are not supported and the printing of double is in fixed format
however, I got the following to work
Code: (Select All)
dim as integer i

for i=1 to 18
    print i, gamma(i)
next

function gamma#(byval x as double) 'as double
    dim as double a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, f, y, z
    dim as double a11, a12, a13, a14, a15, a16, a17, a18, a19, a20
    a1 =  0.9999999999999999
    a2 =  0.08333333333338228
    a3 =  0.003472222216158396
    a4 = -0.002681326870868177
    a5 = -0.0002294790668608988
    a6 =  0.0007841331256329749
    a7 =  6.903992060449035e-05
    a8 = -0.0005907032612269776
    a9 = -2.877475047743023e-05
    a10 =  0.0005566293593820988
    a11 =  0.001799738210158344
    a12 = -0.008767670094590723
    a13 =  0.01817828637250317
    a14 = -0.02452583787937907
    a15 =  0.02361068245082701
    a16 = -0.01654210549755366
    a17 =  0.008304315532029655
    a18 = -0.00284326571576103
    a19 =  0.0005961678245858015
    a20 = -5.783378931872318e-05

    z=2.506628274631001*x^(x-.5)/(2.718281828459045^x) ' *exp(-x)
    f=x*x : f=f*f : f=f*f*x : f=f*f*x 'f = x^19
    y=x*a1+a2
    y=a3+y*x
    y=a4+y*x
    y=a5+y*x
    y=a6+y*x
    y=a7+y*x
    y=a8+y*x
    y=a9+y*x
    y=a10+y*x
    y=a11+y*x
    y=a12+y*x
    y=a13+y*x
    y=a14+y*x
    y=a15+y*x
    y=a16+y*x
    y=a17+y*x
    y=a18+y*x
    y=a19+y*x
    y=z*(a20+y*x)/f

    gamma=y
end function

the exp function is not supported but you can use e^x instead
Reply


Messages In This Thread
The L-BASIC compiler - by luke - 01-06-2023, 01:16 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-06-2023, 08:06 PM
RE: The L-BASIC compiler - by cage - 01-06-2023, 10:24 PM
RE: The L-BASIC compiler - by SpriggsySpriggs - 01-10-2023, 02:39 PM
RE: The L-BASIC compiler - by mnrvovrfc - 01-06-2023, 10:59 PM
RE: The L-BASIC compiler - by mnrvovrfc - 01-08-2023, 08:22 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-08-2023, 09:40 PM
RE: The L-BASIC compiler - by PhilOfPerth - 01-06-2023, 11:01 PM
RE: The L-BASIC compiler - by SMcNeill - 01-07-2023, 12:05 AM
RE: The L-BASIC compiler - by luke - 01-07-2023, 02:27 AM
RE: The L-BASIC compiler - by Kernelpanic - 01-07-2023, 04:01 PM
RE: The L-BASIC compiler - by mnrvovrfc - 01-07-2023, 11:57 PM
RE: The L-BASIC compiler - by Jack - 01-07-2023, 01:39 PM
RE: The L-BASIC compiler - by bplus - 01-07-2023, 02:40 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-07-2023, 06:56 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-07-2023, 08:15 PM
RE: The L-BASIC compiler - by luke - 01-08-2023, 05:08 AM
RE: The L-BASIC compiler - by Kernelpanic - 01-08-2023, 05:24 PM
RE: The L-BASIC compiler - by luke - 01-08-2023, 09:55 PM
RE: The L-BASIC compiler - by Kernelpanic - 01-08-2023, 11:21 PM
RE: The L-BASIC compiler - by a740g - 01-10-2023, 01:13 PM
RE: The L-BASIC compiler - by Jack - 05-20-2024, 01:12 PM
RE: The L-BASIC compiler - by luke - 05-21-2024, 12:14 PM
RE: The L-BASIC compiler - by Jack - 05-21-2024, 12:31 PM
RE: The L-BASIC compiler - by Jack - 05-21-2024, 02:27 PM
RE: The L-BASIC compiler - by Jack - 05-21-2024, 04:24 PM
RE: The L-BASIC compiler - by luke - 05-22-2024, 10:51 AM



Users browsing this thread: 4 Guest(s)