New here - math questions

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
wannaBinventor
Posts: 10
Joined: Tue Feb 08, 2011 10:51 pm

New here - math questions

Post by wannaBinventor » Tue Feb 08, 2011 11:02 pm

I'm working on some projects that require a good deal of floating point math.

I am trying to move over from PIC ASM because I figured a higher level language would rid me of having to deal with the nitty gritty of this kind of thing.

I haven't seen any complex math modules out there. The website indicated that a math module was in the works, but I was wondering if there were any user created modules out there that that can do things like trig (including inverse trig functions), square root, log base 10, natural log, etc.

Thanks!

Jon Chandler
Registered User
Registered User
Posts: 185
Joined: Mon Mar 10, 2008 8:20 am
Location: Seattle, WA USA
Contact:

Post by Jon Chandler » Wed Feb 09, 2011 5:40 am

These are the floating point functions in the math module.

Code: Select all

Subroutines and Functions

function abs (pValue as type) as byte

function trunk (pValue as float) as float

function round (pValue as float) as float

function ceil (pValue as float) as float

function floor (pValue as float) as float

function fmod (x,y as float) as float

function modf (pValue as float, byref pIntegral  as float) as float

function sqrt (pValue as float) as float

function cos (pValue as float) as float

function sin (pValue as float) as float

function tan (pValue as float) as float

function acos (pValue as float) as float

function asin (pValue as float) as float

function atan (pValue as float) as float

function exp (pValue as float) as float

function log (pValue as float) as float

function log10 (pValue as float) as float

function Pow ([pBase as type,] pExp as byte) as longword

function atan2 (y,x as float) as float

function cosh (x as float) as float

function sinh (x as float) as float

function tanh (x as float) as float

function frexp (x as float, byref exp as shortint) as float

function ldexp (value as float, exp as shortint) as float
 

wannaBinventor
Posts: 10
Joined: Tue Feb 08, 2011 10:51 pm

Post by wannaBinventor » Wed Feb 09, 2011 1:23 pm

Thanks for that reply!

How do I get to that? I know I can just include it, but I want to actually open it up and look at it.

I have SF SE downloaded on my computer. I can see samples, but I have no idea where the directory is with all the include files. I'd like to take a look. Can you point me to how to do it?

Jon Chandler
Registered User
Registered User
Posts: 185
Joined: Mon Mar 10, 2008 8:20 am
Location: Seattle, WA USA
Contact:

Post by Jon Chandler » Wed Feb 09, 2011 2:10 pm

If you include the math module:

Code: Select all

Include ("math.bas")
the math module will show up on the left hand side of the screen of the IDE with all the other program parameters. Clicking on it there will open a screen with the module listing.

The commands I listed come from the on-line help file. Click help on the IDE menu bar to find this. It's the best documentation for Swordfish. Enter "math" in the search box, and select "Swordfish Library" from the search results.


Jon

Post Reply