Menu

Complete Trigonometric Package

Anonymous
2014-04-18
2014-04-18
  • Anonymous

    Anonymous - 2014-04-18

    Okay, Gang, I finally finished the complete trig package. This has sine, cosine and tangent accurate to 2, 3 and 4 decimal places. I'm humbly submitting this as a possible addition to the Great Cow Basic include folder, since I believe it will prove useful to the GLCD stuff among other things. Here are a couple notes:

    There are three include files, one for 2 places, another for 3 places and the last for 4 places of accuracy. I wanted to wrap them all up in one file, but I discovered that GCB doesn't permit conditional compilation of tables. So, you'll simply choose the one you want to include manually.

    Note that this is completely generalized code: you can have positive, negative and zero arguments of any size and it works. By the way, the source code is heavily commented if you'd like to learn how it works.

    The include file for 4 places of accuracy omits the tangent function, since the GCB Integer data type isn't big enough to handle the required number of digits.

    Also within are three demos. I'd appreciate it if someone ran these and confirmed that all is as it should be. You can just do them on a simulator if you don't feel like hauling out an LCD. Check it out with a scientific calculator.

    This was a fun project, and I may try my hand at other transcendental functions. In the meanwhile, I undertook this primarily to support GLCD. We now have the tools to do polar equations! Roses and limaçons anyone?

    Finally, can anyone explain why this forum doesn't show the "Attach Files" button in the original posting until I come back and add a response? In the meanwhile, I'll attach the files in the next message, I hope.

     
  • Anonymous

    Anonymous - 2014-04-18

    Okay, the button just appeared, so here are the trig include files.

     
  • Anobium

    Anobium - 2014-04-18

    Great job. I will test over the next few days. If testing is OK then I will move into the latest release.

    Can you 'knock up' some help file pages? Do have time? MSft Word is OK. I can cut and page. I did add some MATHS functions earlier this year and we can add to this information. I would recommend you put you examples in the help file pages - that way the information is readily available... for all those that read the help file.... :-)

    I will like to move these functions into a new MATHS.h which we can then can be extended in the future. I want to keep GLCD.H to address GLCD hardware.

     

    Last edit: Anobium 2014-04-18
  • Anobium

    Anobium - 2014-04-18

    And, a request.

    Sorry to be a pain.

    Can you consolidate the files to one file and the use a #DEFINE to determine the accuracy? And, a second #DEFINE to determine whether the lookup table are to be stored in EEPROM or RAM.

    This will ease the use and the documentation as a table can easily show the functionality with respect to TANGENT not being available at the higher level of precision.

     

    Last edit: Anobium 2014-04-18
  • Anonymous

    Anonymous - 2014-04-18

    Hey, Anobium, It was my intent to consolidate the three precisions in one file to be selected by a #DEFINE. But as I mentioned, conditional compilation doesn't work on Tables. (At least I couldn't make it work after three hours of experimenting). The compiler always compiles the first Table it finds, completely ignoring the #IF or #IFDEF. If anyone know how to do it, please chime in. And the EEPROM choice business is out, too, since the Tangent always requires the Word type; Tables in EEPROM must be Byte. So, I don't believe either of the #DEFINEs you suggest are do-able. I wish they were, though.

    And yes, MATHS.H would be a good place for these routines.

    I'll put together some docs for you tonight.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.