This was something I started to discuss on the IRC last night, but didn't make any real progress.
It is part of the SSI encoder code. Given that these can easily have 32 bits of position data and then LinuxCNC needs to cater for multiple turns I don't see any option but to use 64-bit datatypes. *enc->hal.pin.count = (enc->accum - enc->offset); *enc->hal.pin.position = ((float)(enc->accum - enc->offset)) / enc->hal.param.scale; the count pin (s32) says 2882. hal.param.scale is 1.0 (float param) "position" is 1.073742e+12 In response to a reply from cradek after I had logged off of the IRC, I have tried casting to double too, and even to hal_float_t. The result is the same. The strange thing is that the syntax above is what PKM came up with to make it work on his system, and it works for him. I only recently got some SSI hardware to play with. Considering the fact that I managed to write a bug into the Resolver code that meant that it didn;t work at all on a 64-bit kernel I think I need advice on how to portably and reliably perform the calculation above. It is quite likely that accum - offset will be more than 32 bits. Casting individually to float before the subtraction was suggested, but that risks losing precision. It also doesn't help the problem (!) I tried passing the result to a double variable before the indirection, again no difference and a printf of the (double) temp variable value showed huge values too, so I don't think that it is a problem with (for example) other code writing garbage to the pin shared memory. It may be that I am lacking a 64-bit maths library, but the truly strange thing is still that this works as expected for PKM. -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
