Re: [Emc-developers] Floating point precision
Where is the benefit though? There was a time with 8 bit and 16 bit CPU's floating point should be ignored wherever possible but now it's pretty hard to even find a 32 bit PC. Everything is 64 bit So with current architecture, there is no benefit in worrying about this at all. Rod Webster *1300 896 832* +61 435 765 611 Vehicle Modifications Network www.vehiclemods.net.au On Sun, 4 Jul 2021 at 19:45, n...@nksb.eu wrote: > > Drift might be a problem but due to many significant digits almost > certainly more of an annoyance than a real problem. > > There is however a fundamental difference between ordinary integers or > intepreted as a fixed decimal point and ordinay floating point numbers. For > fixed point some of the lower digits are treated as decimal points though I > never have seen it the other direction will of course also work, for > addition/subtraction there will be no drift. For floating point a number of > bits are used for the number while the others except one bit I think is > used for sign is used to place decimal point. Floating point may store a > very large range of numbers so are usually simpler to use, resolution is > higher around zero, in particular some integer values are missing for large > enough numbers as number of significant numbers are constant. > > Do not think you have any reason to care about drift of absolute value or > square root except then you compare numbers as they usually do not make a > perfect fit. Ideally sqrt(x^2)=x but then using floating point there is a > small difference, or you do nuclear fission and count part of an atom? > > > Den Lördag, Juli 03, 2021 09:32 CEST, skrev Alec Ari via Emc-developers < > emc-developers@lists.sourceforge.net>: > Hello, > > Just curious, how would LinuxCNC detect a lack of precision in floating > point? There are trivial x86_64 specific math instructions which would > probably be faster than what LinuxCNC has used since the beginning but if > these instructions happened to be off by a few decimals somewhere, how > would you know? Would LinuxCNC throw a fault or would the machine just > drift further and further away from where it's supposed to be or what? > > The functions in question are: > > https://git.musl-libc.org/cgit/musl/tree/src/math/x86_64/fabs.c > > and > > https://git.musl-libc.org/cgit/musl/tree/src/math/x86_64/sqrt.c > > Thanks! > > Alec > > > ___ > Emc-developers mailing list > Emc-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-developers > > > > > ___ > Emc-developers mailing list > Emc-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-developers > ___ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers
Re: [Emc-developers] Floating point precision
Drift might be a problem but due to many significant digits almost certainly more of an annoyance than a real problem. There is however a fundamental difference between ordinary integers or intepreted as a fixed decimal point and ordinay floating point numbers. For fixed point some of the lower digits are treated as decimal points though I never have seen it the other direction will of course also work, for addition/subtraction there will be no drift. For floating point a number of bits are used for the number while the others except one bit I think is used for sign is used to place decimal point. Floating point may store a very large range of numbers so are usually simpler to use, resolution is higher around zero, in particular some integer values are missing for large enough numbers as number of significant numbers are constant. Do not think you have any reason to care about drift of absolute value or square root except then you compare numbers as they usually do not make a perfect fit. Ideally sqrt(x^2)=x but then using floating point there is a small difference, or you do nuclear fission and count part of an atom? Den Lördag, Juli 03, 2021 09:32 CEST, skrev Alec Ari via Emc-developers : Hello, Just curious, how would LinuxCNC detect a lack of precision in floating point? There are trivial x86_64 specific math instructions which would probably be faster than what LinuxCNC has used since the beginning but if these instructions happened to be off by a few decimals somewhere, how would you know? Would LinuxCNC throw a fault or would the machine just drift further and further away from where it's supposed to be or what? The functions in question are: https://git.musl-libc.org/cgit/musl/tree/src/math/x86_64/fabs.c and https://git.musl-libc.org/cgit/musl/tree/src/math/x86_64/sqrt.c Thanks! Alec ___ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers ___ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers
Re: [Emc-developers] Floating point precision
On Sat, 3 Jul 2021 at 08:33, Alec Ari via Emc-developers wrote: > Just curious, how would LinuxCNC detect a lack of precision in floating > point? There are trivial x86_64 specific math instructions which would > probably be faster than what LinuxCNC has used since the beginning but if > these instructions happened to be off by a few decimals somewhere, how would > you know? Would LinuxCNC throw a fault or would the machine just drift > further and further away from where it's supposed to be or what? I suspect that you would never notice. LinuxCNC only really needs to work to microns ot tenths of thou, so as long as it's all good to 5 decimal places it is unlikely that a problem would be seen. The motors (spindles aside) don't turn long enough in one direction to accumulate errors. And spindles tend to re-zero the encoder counters when doing synchronised moves. -- atp "A motorcycle is a bicycle with a pandemonium attachment and is designed for the especial use of mechanical geniuses, daredevils and lunatics." — George Fitch, Atlanta Constitution Newspaper, 1912 ___ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers