From: f DOT natter AT ndh DOT net (Felix Natter) Newsgroups: comp.os.msdos.djgpp Subject: Re: multidimensional arrays and math inaccuracy Date: Sat, 29 May 1999 21:10:17 GMT Organization: Customer of NDH Netzwerkdienste Hoeger GmbH Lines: 50 Message-ID: <37505323.5502462@news.ndh.net> References: <374edbb4 DOT 18530235 AT news DOT ndh DOT net> <374f3132 DOT 519315 AT noticias DOT iies DOT es> NNTP-Posting-Host: port239.bonn.ndh.net X-Trace: public.ndh.net 928012118 4151 195.94.93.239 (29 May 1999 21:08:38 GMT) X-Complaints-To: abuse AT ndh DOT net NNTP-Posting-Date: 29 May 1999 21:08:38 GMT X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com but the system is rather simple: |20 40 10| |20| |30 10 10| |x| |18| |10 10 15| times |y| = |12| |25 20 40| |z| |30| |15 20 25| |20| (look below for a latex-version) I had sometime written the system and the way to get the solutions in LaTeX2e. so if you've got LaTeX, you can download the document @ http://www.ndh.net/home/natter/example.tex (it's in German, look for 'Aufgabe 1') the thing is that when you solve this system using Gaussian Elimination, all the factors by which you scale the 'rows' are rational numbers. the most "complicated" fraction by which you multiply is probably -1/11 - would this bring the accuracy of a double to its knees. Would you recommend that I always use arbitrary precision math for such algorithms ? (I don't think the idea to set anything to zero if |x| < SMALL_NUMBER, as this would make the algorithm unusable for other systems. Felix Natter On Sat, 29 May 1999 11:48:03 GMT, XXguille AT XXiies DOT XXes (Guillermo Rodriguez Garcia) wrote: >El día Fri, 28 May 1999 18:22:17 GMT, f DOT natter AT ndh DOT net (Felix Natter) >escribió: > >>solution (in this code it's .2, .4, .2), there will be a math >>inaccuracy: where an entry should have been reduced to 0.0, it becomes >>something*10^(-15), resulting in the algorithm continuing and giving a > >There is a limit on the 'double' accuracy (this doesn't only happen in >DJGPP; every C compiler will have the same problem), so if you are not >using some arbitrary-precision math library (gnu has one), that is, if >you are using the standard double type and the standard math.h, just >check the values you get and interpret those below a given threshold >as zero. > >Regards: >GUILLE >---- >Guillermo Rodriguez Garcia >XXguille AT XXiies DOT XXes (ya sabes :-)