math.h ceil problem

kuldeep dhaka <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <CANPwNKVsyJDMEFG7wksWr5b1fbF-QGoso3X5F6qy6eGx7xQB9A@mail.gmail.com>
//c program

#include <msp430.h>
#include <math.h>

void main(void)
{
    unsigned int i = ceil(12/5);

    P1DIR = i;
}

/////output

    .file    "prog1.c"
    .arch msp430g2553
    .cpu 430
    .mpy none

    .section    .init9,"ax",@progbits
    .p2align 1,0
.global    main
    .type    main,@function
/***********************
 * Function `main'
 ***********************/
main:
    mov.b    #2, &__P1DIR
.LIRD0:
.Lfe1:
    .size    main,.Lfe1-main
;; End of function

////makefile
PREFIX=msp430-

MCU=msp430g2553

# c compiler
CC=$(PREFIX)gcc
CFLAGS=-O2 -mmcu=$(MCU)

all:
    $(CC) $(CFLAGS) -save-temps -o prog1.elf    prog1.c



i was expecting ceil(12/5) = 3 not 2.

-- 
*Kuldeep Singh Dhaka*
Sakul
+91-8791676237
[email protected]
Programmer, Open Source, Web Developer, System Administrator, Entrepreneur,
Animal Lover, Student, Reverse Engineer, Embedded System, Learning.

Bitcoins Accepted.
My GnuPG Public
Key<http://pgp.mit.edu:11371/pks/lookup?op=get&fingerprint=on&search=0x23816C5609DC7E26>
Fork Me <https://github.com/kuldeepdhaka>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.