05-14-2022, 02:17 PM
I want to convert any binary number of lets say less than 512 bit, to a base 20 integer.
Is there a way to do that with some built in features of the calculator as is, or does it need a program?
I have written a little program anyway, that will take in any length of a binary number in string format, but I do not know how to convert it to a number that can retain a large amount of digits. Is there a CAS command or function that will allow that?
If you run this as : B2D("10110110110"), then it will return 1,426. But if you enter a larger binary number, then the amount of digits will get truncated to 12 with an E45, for example, at the end, and therefore numbers will be lost. I would like the number output (or string I suppose) to be as large as it has to be, to house every piece of information that the binary number contained. It would be best if it was a number form, so that it could then be further manipulated.
Is there a was to force CAS level number sizes, and accuracy of upwards of 90 base 10 digits?
Is there a way to do that with some built in features of the calculator as is, or does it need a program?
I have written a little program anyway, that will take in any length of a binary number in string format, but I do not know how to convert it to a number that can retain a large amount of digits. Is there a CAS command or function that will allow that?
Code:
EXPORT B2D(A)
BEGIN
// LOCAL A:="";
LOCAL B:=0;
// INPUT({{A,[2]}});
FOR X FROM 1 TO size(A) DO
IF expr(A(size(A)-(X-1),1)) THEN
B:=B+2^(X-1);
END;
END;
B;
END;
If you run this as : B2D("10110110110"), then it will return 1,426. But if you enter a larger binary number, then the amount of digits will get truncated to 12 with an E45, for example, at the end, and therefore numbers will be lost. I would like the number output (or string I suppose) to be as large as it has to be, to house every piece of information that the binary number contained. It would be best if it was a number form, so that it could then be further manipulated.
Is there a was to force CAS level number sizes, and accuracy of upwards of 90 base 10 digits?