davidcsterratt / RTriangle

Port of the Triangle Two-Dimensional Quality Mesh Generator and Delaunay Triangulator to R
https://cran.r-project.org/package=RTriangle
9 stars 4 forks source link

Modularise and simplify code for passing a and q #2

Closed epipping closed 8 years ago

epipping commented 8 years ago

Instead of determining a formatting string that is suited to the number we're passing to sprintf, we go with the worst case, building on the constants from float.h

I believe this addresses all the suggestions from #1.

epipping commented 8 years ago

I've pushed another change that simplifies the code further using the * specified to printf. I'm not sure how portable that is. Found it at

http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html

at least. If you rule in favour of this second change, I should probably squash the two commits in a rebase first.

davidcsterratt commented 8 years ago

This seems to work on Linux and Windows - all tests are passed at least. This looks like a neat solution. My only thought is that it might be neater to have a #define for maxprecision rather than a function, seeing as everthing is determined at compile time - what do you think?

epipping commented 8 years ago

Happy to hear that. You're right of course, using a function is entirely unnecessary. I've pushed another change.