CART
  • Cart is empty.

    ItemQuantityPrice

    Total: $0

Floating point math


This program does a simple multiplication and division of float numbers.

Toolkit:SDCC 8051 Development System

Location:/bipom/devtools/SDCC/examples/float/

Code Example


int main()
{
    float f1,f2;
    float fmul;
    float fdiv;
    
    /* Set the serial port to 19200 Baud */
    serinit(CBR_19200);
    
    f1 = 12.5;
    f2 = 3435.8567;
    
    fmul = f1 * f2;
    
    fdiv = f1  f2;
    
    printf("f1 * f2 = %f \n\r", fmul);
    printf("f1 / f2 = %f \n\r", fdiv);
    
    return 0;
}