Menu

Float Representation

Chris
2006-04-10
2013-03-12
  • Chris

    Chris - 2006-04-10

    Hi All,

    main()
    {

    volatile float a,b,c;
        a=-12.5;
        b=2.5;
        c=a+b;
        printf("The number is%f \r\n",c);
        return 0;
    }

    As per SDCC variable 'a' is passed through
    a -- SE...E
    b -- E....M
    dph--M....M
    dpl--M....M  Registers.

    later ___fsadd(library) is called
    The return values are in a,b,dph,dpl. If i replace the fsadd library with a function call where no operation is done and returned

    ___my_fsadd:

    nop
    nop
    ret

    The value in a,b,dph,dpl is -12.5

    But when i print the value i get -12.!`x (ie) i am not getting the values after the decimal point.

    I expect the result of -12.5 to be printed.

    What should be the problem?.

    Sorry to disturb you all with basic concepts. I tried a lot to debug the mistake but in vain :-(. If you need the supporting files i am ready to send it.

    Thanks once again,
    Chris

     
    • Maarten Brock

      Maarten Brock - 2006-04-11

      Chris,

      If you think this is a bug, please file a bug report. Otherwise you can file a support request. Both allow you to attach the source and generated asm files.

      Thanks,
      Maarten

       

Log in to post a comment.