Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/pure-cfg/test/sqrt.diderot
ViewVC logotype

View of /branches/pure-cfg/test/sqrt.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1738 - (download) (annotate)
Tue Mar 20 18:14:18 2012 UTC (8 years ago) by glk
File size: 437 byte(s)
new minimal demo
// ../bin/diderotc sqrt.diderot && ./sqrt -nrrd && unu axdelete -i sqrt.nrrd -a -1 | unu dhisto -i - -h 400 -nolog | XV

// Global definitions
input real eps = 0.000001;
// Strand definition
strand sqroot(real val) {
   output real root = val;
   update  {
      root = (root + val/root)/2.0;
      if (|root^2 - val|/val < eps) {
         stabilize;
      }
   }
}
// Strand initialization
initially [ sqroot(real(i)) | i in 1..1000 ];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0