# SCM Repository

# View of /tests/examples/heron/README.md

Parent Directory | Revision Log

Revision

File size: 1950 byte(s)

**4640**- (**download**) (**annotate**)*Tue Sep 27 20:54:47 2016 UTC*(2 years, 9 months ago) by*glk*File size: 1950 byte(s)

initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/

This program finds square roots of numval reals between minval and maxval using Heron's method (aka the Babylonion method) https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method Assuming the directions at https://github.com/Diderot-Language/examples this program can be compiled and run with: ../../vis12/bin/diderotc --exec heron.diderot ./heron The output stores four numbers for each value processed (by index along fast axis): <ol start=0> <li> the value whose square root was found <li> the computed square root <li> the number of iterations taken to compute it <li> the error, relative to Diderot's sqrt() function </ol> To see the values (one set of 4 numbers per line): unu save -f text -i vrie.nrrd The command-line executables produced by Diderot have hest-generated usage infomation; try: ./heron --help to see how to set the input values and output filename stem. Note that the input variables self-document their purpose with ("...") annotations, which are in turn included in the generated `--help` usage information. So the declarations: input real minval ("min value to find root of") = 1; input real maxval ("max value to find root of") = 100; input int numval ("how many values to compute") = 100; input real eps ("relative error convergence test") = 0.000001; become in the usage information: -minval <val> = min value to find root of (double); default: "1.000000" -maxval <val> = max value to find root of (double); default: "100.000000" -numval <int> = how many values to compute (long int); default: "100" -eps <val> = relative error convergence test (double); default: "0.000001" Try experimenting with different values for eps; if it is set too low the algorithm may not converge. Compiling with: ../../vis12/bin/diderotc --double --exec heron.diderot makes "reals" into doubles, instead of the default single-precision floats, which permits higher-accuracy results.

root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |

Powered by ViewVC 1.0.0 |