#include <stdio.h>

/*
  IEEE Standard for Binary Floating-Point  Arithmetic test
*/
main(){
        unsigned char  unbyte=0xf0;
        unsigned short dosbytes=0xff00;
        unsigned int   cuatrobytes=0xff00ffbb;
        unsigned int i =0;      
        unsigned char *ptr_v =NULL;
        float    un_flotante=6.25; 
        float    copy_un_flotante=0.0;
        float    *ptrfloat=NULL;
        unsigned char ptr_flotante[ 4 ];
        
        for( i=0; i<4 ; i++){
                ptr_flotante[ i ]= 0;
        }        

        ptr_v= (char * ) &un_flotante;

        for( i=0; i<4 ; i++){
                ptr_flotante[ i ]= *(ptr_v + i);
        }        
        printf("Checking original float structure : \n original: ");
        ptr_v = &un_flotante;
        for( i=1; i<=4 ; i++ ){
                 printf("%02x ",*ptr_v );
                ptr_v++;
        }
        printf("\n");
        
        printf("Checking copy float structure : \n copy: ");
        ptr_v=&ptr_flotante;
        for( i=1; i<=4 ; i++ ){
                printf("%02x ",*ptr_v );        
                ptr_v++;
        }
        printf("\n") ;

        printf("Single presicion size: %d \n", sizeof( float )    );
        printf("un_flotante : %f \n", un_flotante            );
        
        ptr_v = &un_flotante;
        printf("ptr_flotante: %f \n",  *ptr_v);
        copy_un_flotante= (float)*ptr_v;
        printf("copy_un_flotante : %f \n", copy_un_flotante );
        
        ptrfloat= &un_flotante;
        printf("ptr to float : %f \n", *ptrfloat );
        ptrfloat= (float * ) &ptr_flotante ;
        printf("ptr to float array copy : %f \n", *ptrfloat );
        
}
