Search found 9 matches

by keithpickering
Apr 25, 2012 20:03
Forum: Beginners
Topic: Writing hex/binary zeroes (or any other hex number)
Replies: 20
Views: 1311

Re: Writing hex/binary zeroes (or any other hex number)

Solving my own problem:

The trick is to eliminate

Code: Select all

print #1, z1
And replace it with

Code: Select all

put #1, i, z1
where i is the index byte number into the file.
by keithpickering
Apr 25, 2012 19:44
Forum: Beginners
Topic: Writing hex/binary zeroes (or any other hex number)
Replies: 20
Views: 1311

Writing hex/binary zeroes (or any other hex number)

Been beating my head against a wall trying to get FB to write a hex zero. Everything I try comes out hex "30" which is the ASCII zero. Here's one example of what won't work: dim z1, z2, z3, z4, z5 as ubyte z1=&h00 z2=0 z3=val(0) z4=valint(0) z5=valuint(0) open "zero.hex" for ...
by keithpickering
Feb 18, 2012 1:29
Forum: Linux
Topic: Compile failure on Ubuntu 11.4 32-bit: FBCOND redefinition
Replies: 1
Views: 541

Compile failure on Ubuntu 11.4 32-bit: FBCOND redefinition

I'm getting the following compile failure under Ubuntu 11.4:

Code: Select all

CC new/libfb/thread_cond_unix.o
rtlib/thread_cond_unix.c:9:3: error: redefinition of typedef 'FBCOND'
compilation terminated due to -Wfatal-errors
make: *** [new/libfb/thread_cond_unix.0] Error 1
Any ideas?
by keithpickering
Feb 15, 2012 18:48
Forum: Sources, Examples, Tips and Tricks
Topic: GSL example usage
Replies: 16
Views: 4574

GSL example: Roots of polynomials

Here's an example program that uses the GSL library to find roots of polynomials of arbitrary power. The resultant roots are complex numbers, so if you're looking for the real roots, you need to look for those roots that have an imaginary part of zero. ' Example program to find roots of polynomials....
by keithpickering
Feb 15, 2012 18:43
Forum: Sources, Examples, Tips and Tricks
Topic: GSL example usage
Replies: 16
Views: 4574

Re: GSL example: basic statistics and sort

Thanks for the tip, we can all learn something new. :)
by keithpickering
Feb 13, 2012 15:57
Forum: Sources, Examples, Tips and Tricks
Topic: GSL example usage
Replies: 16
Views: 4574

Re: GSL example: basic statistics and sort

Perhaps even better is to use a variable to store the size of the array. You can then use the variable (instead of hard coding) to pass to the various functions. I should have thought of this before, but I was following the C example too slavishly. :) ' FreeBasic example program for GSL basic statis...
by keithpickering
Feb 13, 2012 7:39
Forum: Sources, Examples, Tips and Tricks
Topic: GSL example usage
Replies: 16
Views: 4574

GSL example: basic statistics and sort

Continuing with GSL examples. In this one, we create an array, run some basic statistics on it, then sort the array and run a few other statistics that require a sorted input. Once again, note that we use a pointer to the dataa() array. In this example, I'm running in Windows instead of Linux, so I ...
by keithpickering
Feb 12, 2012 7:18
Forum: Sources, Examples, Tips and Tricks
Topic: GSL example usage
Replies: 16
Views: 4574

GSL example: Fast Fourier Transform

Here's an example of how to use the FFT functions in the GSL package. Note that the actual transform functions in FB require you to pass a pointer to the data array rather than the array itself, which you do by pointing to the first array element. It's always best to eyeball the gsl_whatever.bi to c...
by keithpickering
Feb 03, 2012 5:42
Forum: Sources, Examples, Tips and Tricks
Topic: GSL example usage
Replies: 16
Views: 4574

GSL example usage

Thought I would post this example of using GSL within FB, including the proper use of pointers and arrays. This example is a pretty much direct translation of the C example for using the gsl_fit header. KP. ' Test program for linear regression, using gsl_fit.bi functions. ' #include once "gsl/g...