/*
   ###########################################################################
   This function  computes the distance accelerated  at rate (a) during the
   time interval (T) taking into account relativistic time dilation to up
   to 50 decimals of precision.

   ---------------------
   SI UNITS ARE ASSUMED:

   a = Acceleration rate (m/s²)
   T = Time in seconds
   D = Distance in meters

   ERRORS:
   FALSE is returned if any argument is non-numeric.

   NO DEPENDENCIES
   ###########################################################################
*/

   function Accel_T_to_D ($aStr, $TStr, $Decimals=32)
{
   $a = trim($aStr);
   $T = trim($TStr);
   $q = trim($Decimals);

   if (!Is_Numeric($a) or !Is_Numeric($T) or !Is_Numeric($q))
      {return FALSE;}

   $Q = 64;
   $c = '299792458';

// --------------------------
// Set seconds as time units.

   $A = bcDiv(bcMul($a, '1', $Q), $c, $Q);

// ---------------------------------------
// Compute distance accelerated in meters.

   $RecipA  = bcDiv('1', $A, $Q);
   $RecipA2 = bcMul($RecipA, $RecipA, $Q);
   $T2      = bcMul($T, $T ,$Q);

   return bcMul(bcSub(bcSqRt(bcAdd($T2,$RecipA2,$Q),$Q),$RecipA,$Q),$c,$q);

}// End of  Accel_T_to_D (...)