Talk:Check Machin-like formulas: Difference between revisions

Line 18:
==Floating-point calculations==
I don't believe the J or Perl 6 entries are using exact arithmetic, unless they are using non-obvious symbolic language features. I will flag these as incorrect unless someone can explain how they are exact. [[User:TobyK|TobyK]] 13:16, 20 December 2012 (UTC)
: In J, exact arithmetic is termed "extended precision" (or when specifically describing non-integral values, we sometimes say "rational"). And, as noted in the J solution "''the function '''<tt>x:</tt> coerces values to extended precision'''; thereafter J will maintain extended precision throughout its calculations, as long as it can.''".
:For example, dividing one by seven with <tt>1%7</tt> by default produces the float point approximation <tt>0.142857</tt>, but coercing extended precision with <tt>x: 1%7</tt> produces the exact ratio <tt>1r7</tt> (which is J's notation for rational numbers). J will carry exact values as far as it can through its computations; there are some built-in functions which have not been designed to produce exact results, and will revert to floating point values. Users have no control over these functions, and if they want a work-alike that produces exact results, they must write it themselves.
:--[[User:DanBron|DanBron]] 20:04, 20 December 2012 (UTC)
Anonymous user