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