Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

Math test.

// Built with BFTC Rev. 1.0.0, ven 19 settembre 2014 15:37:44

#include "main.h"

// Output of the same code with VisualStudio 2010
//
// sin(45)    = 0.7071067811865475
// asin(45)   = 44.9999999999999930
// cos(45)    = 0.7071067811865476
// acos(45)   = 45.0000000000000000
// tan(33)    = 0.6494075931975106
// atan(33)   = 33.0000000000000000
// sinh(18)   = 0.3193525397881006
// cosh(18)   = 1.0497552308367462
// tanh(18)   = 0.3042161928867445
// sqrt(2)    = 1.4142135623730951
// pow()      = 2.0000000000000004
// log(1000)  = 6.9077552789821368
// exp()      = 999.9999999999997700
// log10(1000)= 3.0000000000000000
// pow()      = 1000.0000000000000000
// ceil(PI)   = 4.0000000000000000
// floor(PI)  = 3.0000000000000000

int main(void)
{
    double      v = 45;
    Set_PLL(16, 4);     // CORE: 25MHz * 16 = 400MHz, SCLK: 400MHz / 4 = 100MHz
    Set_Port();         // Set the port according to project set
    Set_Uart0(115200);  // printf is redirected to UART0
    GetChar_Uart0();
    v = sin(DEG_TO_RAD(v));
    printf("sin(45)  = %.16lf\n", v);
    v = RAD_TO_DEG(asin(v));
    printf("asin(45) = %.16lf\n", v);
    v = cos(DEG_TO_RAD(45));
    printf("cos(45)  = %.16lf\n", v);
    v = RAD_TO_DEG(acos(v));
    printf("acos(45) = %.16lf\n", v);
    v = tan(DEG_TO_RAD(33));
    printf("tan(33)  = %.16lf\n", v);
    v = RAD_TO_DEG(atan(v));
    printf("atan(33) = %.16lf\n", v);
    v = sinh(DEG_TO_RAD(18));
    printf("sinh(18) = %.16lf\n", v);
    v = cosh(DEG_TO_RAD(18));
    printf("cosh(18) = %.16lf\n", v);
    v = tanh(DEG_TO_RAD(18));
    printf("tanh(18) = %.16lf\n", v);
    v = sqrt(2.0);
    printf("sqrt(2)  = %.16lf\n", v);
    printf("pow()    = %.16lf\n", pow(v, 2));
    v = log(1000.0);
    printf("log(1000)= %.16lf\n", v);
    printf("exp()    = %.16lf\n", exp(v));
    v = log10(1000.0);
    printf("log10(1000)= %.16lf\n", v);
    printf("pow()    = %.16lf\n", pow(10, v));
    printf("ceil(PI) = %.16lf\n", ceil(M_PI));
    printf("floor(PI)= %.16lf\n", floor(M_PI));
    
    while(1)                    // Main loop
    {
    }
    return 0;
}

Generated on Tue Apr 7 20:07:44 2015 for BF592A Library by doxygen 1.3.1