Jump to content
LazyPIC

Boostbasic & Floating Point Maths

Recommended Posts

I need to use floating point maths with BoostBasic, but I get silly errors with the most trivial program.

 

Using the Extern function, the following line generates an error and fails to compile:-

 

Extern Function float32_add(x1 as float,x2 as float) as float

 

The compiler lists two errors:-

 

Missing right paren(thesis)

Missing data type

 

I cannot see a missing right parenthesis and I have tried various permutations with no success.

I have added "float.pic18.lib" to the project (I am using a PIC18F452)

Does anyone have any ideas?

Share this post


Link to post
Share on other sites

Could it be that BoostBasic does not support the float data type ?

 

The float libraries seem to be only for C and C++ according to the reference manual.

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites
Could it be that BoostBasic does not support the float data type ?

 

Yes this is the exact reason. BoostBasic does not recognise 'float' data type. We have already fixed this problem and after this fix were able to use BoostC floating point library with BoostBasic. This fix will be available in the next release (or update)

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
Could it be that BoostBasic does not support the float data type ?

 

Yes this is the exact reason. BoostBasic does not recognise 'float' data type. We have already fixed this problem and after this fix were able to use BoostC floating point library with BoostBasic. This fix will be available in the next release (or update)

 

Regards,

Pavel

Following help from Pavel, I can get the maths functions to work, but some of the comparison functions fail, namely: ge, gt, ge_quiet and gt_quiet.

For example, using "Extern Function float32_ge(a as float, b as float) as boolean", together with "result = call float32_ge(x1,x3)", where result, x1 and x3 are float type, results in a first build pass success, then 11 lines repeating

"error: unresolved external function: 'float32_ge(float,float)' " followed by an exit code of -2.

 

Unfortunately the "ge" and "gt" functions are needed for the program which I am developing.

 

regards,

 

Don

Share this post


Link to post
Share on other sites
...Following help from Pavel, I can get the maths functions to work, but some of the comparison functions fail, namely: ge, gt, ge_quiet and gt_quiet.

For example, using "Extern Function float32_ge(a as float, b as float) as boolean", together with "result = call float32_ge(x1,x3)", where result, x1 and x3 are float type, results in a first build pass success, then 11 lines repeating

"error: unresolved external function: 'float32_ge(float,float)' " followed by an exit code of -2...

 

There are no such functions as float32_gt or float32_ge in the library. If you look into float.h file you'll find that these two are defines based on float32_lt and float32_le functions. Use these two instead.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

The new release 6.89 now supports float data type in BoostBasic and includes a sample project that shows how to use float math in basic.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×