Overview
| Artifact ID: | bb744a8fe33db5ce4f895b091e35718021421ea4 |
|---|---|
| Ticket: | 1003145fffffffffffffffffffffffffffffffff
expr int operation giving different results for same values |
| User & Date: | dkf on 2004-08-06 15:03:41 |
Changes
- assignee changed to: "dkf"
- closedate changed to: "2004-08-06T08:03:41"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Further comment: I don't know what C compiler you're using, but I don't get 999996 throughout for C. (See below for details.) This indicates to me that your expectations of floating point math are unrealistic and that this is not actually a bug. IOW, everything's happening just right, but you don't think the world should be arranged that way. Tough luck. ------PROGRAM------ #include <stdio.h> int main() { double d = 999996.0; printf("%f\t%d\n", d, (int)d); d = 9999.96; printf("%f\t%d\n", d, (int)d); d *= 100.0; printf("%f\t%d\n", d, (int)d); d = 9999.96; printf("%f\t%d\n", d, (int)d); d *= 100; printf("%f\t%d\n", d, (int)d); return 0; } ------OUTPUT------ 999996.000000 999996 9999.960000 9999 999996.000000 999995 9999.960000 9999 999996.000000 999995 ------MISC.INFO------ Compiled with: gcc -O3 -Wall Compiled and run on: AMD Athlon running RH9 with gcc 3.2.2 - login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "dkf"