fprintf(' \n This code will convert a base 10 number to base 2 \n ');
y = input(' Give your base 10 number. ');
neg = 1; % Check the sign of y
if (y < 0) 
y = -y;
neg = -1;
end
int_part_y = floor(y);
dec_part_y = y - int_part_y
x = dec_part_y
j = 1; % counter
while (x > 0)
x = 2*x;
d(j) = floor(x); % base 2 digits
j = j+1;
x = x - floor(x); % get new decimal part
end
n = length(d);
a(2:n+1) = d;
a(1) = 0;
base2 = horner(0.1,a);