home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   sci.math.symbolic      Symbolic algebra discussion      10,432 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,093 of 10,432   
   jacob navia to All   
   Re: square roots algo   
   20 Jan 21 17:38:42   
   
   From: jacob@jacob.remcomp.fr   
      
   Le 20/01/2021 à 16:42, Richard Fateman a écrit :   
   > On Tuesday, January 19, 2021 at 11:22:47 PM UTC-8, Mostowski Collapse wrote:   
   >> What was the rounding mode?   
   >> Round towards bullshit?   
   >>   
   >> Richard Fateman schrieb:   
   >>> I have repeatedly posted one-line programs in Mathematica that lose   
   >>> a decimal digit about every 3 times through a loop. The computation,   
   repeated, is   
   >>> x= 2*x-x   
   >   
   > I think that may be a fair description of the default (and only) rounding   
   mode.   
   > If you have a copy of Mathematica, try this   
   >   
   > x=1.00000000000000000000   
   > Do[x = 2*x - x, 120]   
   > If[x==0.0,BS]   
   >   
   > returns  BS.   
   >   
   >   
      
   This program   
      
     1 #include "qhead.h"   
      2 int main(void)   
      3 {   
      4     Qfloat q[1],tmp[1];   
      5   
      6     asctoq("1.00000000000000000000",q,NULL);   
      7     for (int i=0; i<1200000; i++) {   
      8         qmul(q,qtwo,tmp); // q= q*2   
      9         qsub(q,tmp,q);    // q = (q*2) - q   
     10     }   
     11     qprint(q);   
     12 }   
      
   prints (after 1 200 000 iterations)   
      
   1   
      
   The syntax is shown using the raw library. Using my compiler system   
   (lcc-win) you can use these floats as a primitive type:   
      
      8   
      9         q  = (q*2) - q;   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca