The C routine distmod first checks the boundary conditions. Then, depending on the value of , the proper motion distance (eq. 4) is calculated. But this is a problem. The IDL environment which is used by IDL to run the C routine has far worse numerical properties than a usual environment where you run a compiled C program from the command line. To be precise, the IDL environment does not even match the minimum set of numerical properties which is demanded for any C distribution. The actual problem is that the IDL environment only evaluates as true, if . This is insufficient for the comparisons on needed to decide if , or . For this reason the comparisons had to be changed to some kind of fuzzy definition for 0 and the actual comparisons are deciding if , or , respectively. The rest of the calculation in distmod is straightforward.