Gregory Brown
12/23/2005 5:07:00 PM
On 12/22/05, James Edward Gray II <james@grayproductions.net> wrote:
> I'm trying to understand the argument to BigDecimal#sqrt. I figured
> it was for precision and it does seem to affect it, but I can't
> understand the exactly relationship. Can anyone tell me what the
> argument controls and how?
This is the C source, if you haven't looked at it yet.
BigDecimal_sqrt(VALUE self, VALUE nFig)
{
ENTER(5);
Real *c, *a;
S_INT mx, n;
GUARD_OBJ(a,GetVpValue(self,1));
mx = a->Prec *(VpBaseFig() + 1);
n = GetPositiveInt(nFig) + VpDblFig() + 1;
if(mx <= n) mx = n;
GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
VpSqrt(c, a);
return ToValue(c);
}
I don't fully understand what's going on with it, because my C is
pretty weak, but hopefully this will provide some insight from
someone.