Jump to content


Photo

Boostbasic & Floating Point Maths


5 replies to this topic

#1 LazyPIC

LazyPIC

    Newbrie

  • Members
  • 2 posts

Posted 24 May 2008 - 05:30 AM

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?

#2 Reynard

Reynard

    Maniac

  • EstablishedMember
  • PipPipPipPip
  • 662 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Archery - target and field

Posted 25 May 2008 - 08:50 PM

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

#3 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,446 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 25 May 2008 - 11:36 PM

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

#4 LazyPIC

LazyPIC

    Newbrie

  • Members
  • 2 posts

Posted 27 May 2008 - 06:56 AM

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

#5 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,446 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 27 May 2008 - 11:32 AM

...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

#6 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,446 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 04 August 2008 - 12:12 AM

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



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users