<i>Floating point precision problems on x86 musl</i> status still Open with 3 other changes
by
.
D 2022-07-14T18:49:04.014
J icomment Unfortunately,\sstrange\splatform\sissues\slike\sthis\scan\sbe\shard\sto\sdebug\s"at\sarm's\slength".\s\sI\sdon't\shave\san\sAlpine\smachine\sto\stest\son\s(and\sI\sthink\sthat\sall\sthe\sAlpine\smachines\sI've\sever\sencountered\shave\sbeen\sARM\srather\sthan\six86).\r\n\r\nDisabling\sthe\srounding\smode\sisn't\sthe\scorrect\ssolution\s(obviously,\ssince\sit\sstarts\sbreaking\sother\sthings!)\s-\sso\swe\sneed\sto\sget\sto\sthe\sbottom\sof\sthis.\s\r\n\r\nIt\swould\sappear\sthat\sit's\ssomething\sgone\samiss\sin\sthe\senvironment.\s\sI've\stested\s8.6.11\swith\sthe\sstandard\sTcl\stest\ssuite\son\sboth\sgcc\sand\sclang\son\sXubuntu\s20.04\sLTS,\sand\sthe\stests\sare\spassing.\s\sLikewise,\sall\sthe\stest\sin\sthe\s`math`\smodule\sof\stcllib\sare\spassing\sas\swell,\swith\sboth\sgcc\sand\sclang\sbuilds.\r\n\r\nFor\sstarters,\swhat\scompiler\sis\sthis?\s\s(I\sdon't\sknow\sif\sAlpine\suses\sgcc,\sclang,\stcc\sor\ssomething\sall\sits\sown...)\sAre\syou\schanging\soptimization\sflags\r\nfrom\sthe\sset\sthat\stcl/unix/configure\sprovides?\r\n\r\nThe\stesting\sof\sfloating\spoint\sconversion\sis\spretty\scomprehensive.\sI\sdon't\sthink\sanything\sthat\swould\sintroduce\sbreakage\sof\sthis\smagnitude\swould\sslip\sthrough\sTcl's\sown\stest\ssuite.\s\s(You\sdid\ssay\sthat\severything\sin\sTcl's\sown\stests\spassed\sbefore\syou\sstarted\sadjusting\sthe\srounding\smodes,\sright?)\r\n\r\nThe\sbroken\sTcllib\smath\stests\ssuggest\sthat\ssomething\svery\sweird\sis\sgoing\son.\sThe\s'Trig-2.3'\stest\sis\sprobably\sthe\seasiest\sto\sattack\s-\sit's\snot\sdoing\sanything\sterribly\sout\sof\sthe\sordinary\sand\sits\sexecution\spath\sis\sonly\sa\sfew\slines\sof\sTcl,\sbut\sthe\soutputs\sgrow\sincreasingly\sbizarre.\s(The\snelderMead\stests\salso\sindicate\ssomething\svery\sfundamental,\sbecause\sthey\sjust\sdo\sbasic\sarithmetic.)\r\n\r\nOne\svery\sodd\spossibility\sis\sthat\sthe\sfloating\spoint\smode\ssetting\sis\sbeing\sreordered\sby\sthe\soptimizer\sin\sthe\scompiler\syou're\susing.\s\sI've\sheard\srumoured\sthat\sin\ssome\scompilers\sit's\snecessary\sto\sreplace\sthe\sline\r\n```\r\ndouble\sretval;\t\t/*\sValue\sof\sthe\snumber.\s*/\r\n```\r\nin\stwo\splaces\s(the\s`MakeLowPrecisionDouble`\sand\s`MakeHighPrecisionDouble`\sfunctions\sin\s`tclStrToD.c`)\swith\r\n```\r\nvolatile\sdouble\sretval;\s/*\sValue\sof\sthe\snumber\s*/\r\n```\r\nto\sprevent\sthat\sfrom\shappening.\s\sI've\snot\sfound\sthat\sto\sbe\snecessary\sat\sthe\r\n-O2\ssetting\sthat\sTcl\suses\sby\sdefault,\swhether\susing\sgcc,\sclang,\sor\sVisual\sC++.\r\n\r\nBeyond\sthat,\sthe\snext\sthing\sthat\sI'd\ssuspect\sis\sthat\ssomething\sis\smessed\sup\sin\sthe\sC\slibrary\sor\sthe\scompiler\sintrinsics.\s\sAs\syou've\sprobably\snoticed,\stclStrToD.c\suses\ssome\sodd\sfunctions\s-\sthings\slike\sldexp(),\sfrexp()\sand\scopysign().\s\s\r\n\r\nOf\scourse,\sthe\schange\sto\stclStrToD.c\smight\sbe\sentirely\sa\sred\sherring.\s\sAre\swe\ssure\sthat\s8.6.10\sand\s8.6.11\swere\sbuilt\swith\sthe\ssame\scompiler,\sinclude\sfiles,\ssystem\slibraries\sand\soptimization\sflags?\s\s\s(Another\sreason\sthat\sI\shave\sfor\ssuspecting\sthat\sthe\sissue\smight\sbe\ssomewhere\selse\sis\sthat\sthe\sformat-*\stests\sthat\sare\sfailing\sdon't\sgo\sthrough\stclStrToD.c.\sThey\seventually\sland\sin\sthe\ssprintf()\sfunction\sof\sthe\sC\slibrary.)\r\n\r\nIf\syou\scan\sverify\sthat\s8.6.10\sworks\sand\s8.6.11\sfails\swhen\sbuilt\sin\sthe\ssame\stoolchain,\sthe\snext\sstep\smight\sbe\sto\smake\sa\sshell\sscript\sthat\sexits\swith\sstatus\s0\sfor\ssuccess\son\sa\stest\scase,\sand\sstatus\s1\sfor\sfailure,\sand\sfeed\sthat\sto\s[fossil\sbisect](https://fossil-scm.org/home/help/bisect).\s\sThat's\spretty\sheavyweight\sbut\smight\snarrow\sit\sfrom\sthe\spoint\srelease\sdown\sto\sthe\sindividual\scommit.
J login kbk
J mimetype text/x-markdown
K 713653b951c625ef974f5f06b2e96634ca5fb1f9
U kbk
Z b26afc09002f82ff4152fdb7cc68532e