Skip to content
Tcl Source Code Artifact [bb744a8fe3]
Login

Artifact [bb744a8fe3]

Artifact bb744a8fe33db5ce4f895b091e35718021421ea4:

Ticket change [bb744a8fe3] - Closed ticket [1003145fffffffff|1003145fff]: <i>expr int operation giving different results for same values</i> plus 8 other changes by dkf on 2004-08-06 15:03:41.
D 2004-08-06T15:03:41
J assignee dkf
J closedate 2004-08-06T08:03:41
J closer dkf
J icomment Logged\sIn:\sYES\s\nuser_id=79902\n\nFurther\scomment:\nI\sdon't\sknow\swhat\sC\scompiler\syou're\susing,\sbut\sI\sdon't\sget\n999996\sthroughout\sfor\sC.\s(See\sbelow\sfor\sdetails.)\sThis\nindicates\sto\sme\sthat\syour\sexpectations\sof\sfloating\spoint\nmath\sare\sunrealistic\sand\sthat\sthis\sis\snot\sactually\sa\sbug.\s\nIOW,\severything's\shappening\sjust\sright,\sbut\syou\sdon't\sthink\nthe\sworld\sshould\sbe\sarranged\sthat\sway.\s\sTough\sluck.\n\n------PROGRAM------\n#include\s<stdio.h>\nint\smain()\s{\n\s\s\s\sdouble\sd\s=\s999996.0;\n\s\s\s\sprintf("%f\\t%d\\n",\sd,\s(int)d);\n\s\s\s\sd\s=\s9999.96;\n\s\s\s\sprintf("%f\\t%d\\n",\sd,\s(int)d);\n\s\s\s\sd\s*=\s100.0;\n\s\s\s\sprintf("%f\\t%d\\n",\sd,\s(int)d);\n\s\s\s\sd\s=\s9999.96;\n\s\s\s\sprintf("%f\\t%d\\n",\sd,\s(int)d);\n\s\s\s\sd\s*=\s100;\n\s\s\s\sprintf("%f\\t%d\\n",\sd,\s(int)d);\n\s\s\s\sreturn\s0;\n}\n------OUTPUT------\n999996.000000\s\s\s999996\n9999.960000\s\s\s\s\s9999\n999996.000000\s\s\s999995\n9999.960000\s\s\s\s\s9999\n999996.000000\s\s\s999995\n------MISC.INFO------\nCompiled\swith:\sgcc\s-O3\s-Wall\nCompiled\sand\srun\son:\sAMD\sAthlon\srunning\sRH9\swith\sgcc\s3.2.2\n
J login dkf
J mimetype text/plain
J resolution Invalid
J status Closed
J username dkf
K 1003145fffffffffffffffffffffffffffffffff
U dkf
Z bbffe8f75801f665e6cc7c71d282354e