#include <boost/assert.hpp>
typedef double type_t;
const type_t epsilon = 1e-15;
const type_t ten = 10;
type_t
pow10(type_t value){
return pow( ten, value );
}
type_t
sqrt(type_t n, type_t eps = epsilon) {
BOOST_ASSERT(n >= 0);
if(n == 0) return 0.0;
type_t ScalingExponent = findExponent(n);
n *= pow10(-ScalingExponent);
type_t result = sqrt_kernel(n,eps);
type_t Exponent = findExponent(result);
return result * pow10( -Exponent + (ScalingExponent/2) );
}
Every Choice Changes Everything: The Show
3 days ago

No comments:
Post a Comment