HP Forums
Any Binary Calculators - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Any Binary Calculators (/thread-14022.html)



Any Binary Calculators - Kaliuzhkin - 11-20-2019 07:09 PM

Do any HP calculators work with binary numbers less than one? For example, I want to work with 0.1010b, which would be 0.625 decimal? I want to be able to enter such a number and perform opertions on it.


RE: Any Binary Calculators - Maximilian Hohmann - 11-20-2019 07:29 PM

Hi!

I think the HP-16 is what you are looking for. And most of the smarter calculators (41, 28, 48, 71, 75, 49, 50, 35s, Prime, ...) either do it natively or can be programmed to calculate with binary numbers. Maybe even the recent cheap Casio clones but I didn't bother to cut them out of their blister bags yet.

Regards,
Max


RE: Any Binary Calculators - Jim Horn - 11-20-2019 07:41 PM

I believe the question is regarding non-integer binary numbers. While many HP calculators include binary capability, they are for integer values only.

That said, most are programmable and programs to deal with non-integer values exist. I used one with my work HP-16 to deal with converting to and from binary floating point values in the 1980s. If you are using offset radix binary, you can do that very simply on any of the integer machines or automate it with a few programming steps.

Let us know if you need help with that. Best to you!


RE: Any Binary Calculators - Kaliuzhkin - 11-20-2019 07:44 PM

(11-20-2019 07:29 PM)Maximilian Hohmann Wrote:  Hi!

I think the HP-16 is what you are looking for. And most of the smarter calculators (41, 28, 48, 71, 75, 49, 50, 35s, Prime, ...) either do it natively or can be programmed to calculate with binary numbers. Maybe even the recent cheap Casio clones but I didn't bother to cut them out of their blister bags yet.

Regards,
Max

I have the HP-35s and HP-48gii but they don't work with binary numbers less than 1. They do limited work with integers GE 1. Even calculating with #0.1010b is very limited. I want #1010b / #10000b but that comes out #0b.

Maybe it's a matter of terminology. I want to work with numbers base 2. Binary might mean something different.


RE: Any Binary Calculators - Giuseppe Donnini - 11-20-2019 08:35 PM

Jake Schwartz' excellent HP-16C emulator for the HP-48 (SX or GX) does the job.

http://www.pahhc.org/mul8r.htm


RE: Any Binary Calculators - BruceH - 11-20-2019 11:36 PM

None of HP's calculators allow fractional binary, or other non-decimal.

I'm not aware of any calc from any other manufacturer that does this.


RE: Any Binary Calculators - Joe Horn - 11-21-2019 01:05 AM

If you have an RPL model or a Prime, here are programs already available which perform arithmetic on numbers (including fractions) in any base:

BASECALC for any HP 48
BASECALC for the HP 49/50

I use the above a lot. Highly recommended.

This program for the HP Prime converts any number (including fractions) to/from any other base:

BASECALC for the HP Prime


RE: Any Binary Calculators - Massimo Gnerucci - 11-21-2019 07:35 AM

IIRC... my TI SR-22 does this for decimal, octal and hexadecimal, alas no binary.


RE: Any Binary Calculators - burkhard - 11-21-2019 05:52 PM

Yeah, generally when people work in binary (or hex or octal for that matter) they are doing integer math which is the "native" way many computers and microprocessors handle numbers.

It's clear that what you are trying to do is floating-point arithmetic with numbers that are not base 10 (specifically base two).

That's (I think) a pretty unusual requirement. May I ask what the application is for?

When people talk about a calculator working in binary or hex, it's generally assumed that it's integer math involved, not floating-point. Your case is an exception...


RE: Any Binary Calculators - Kaliuzhkin - 11-21-2019 06:23 PM

(11-21-2019 05:52 PM)burkhard Wrote:  Yeah, generally when people work in binary (or hex or octal for that matter) they are doing integer math which is the "native" way many computers and microprocessors handle numbers.

Except that computers and microprocessors handle floating point numbers as binary floating point numbers. Even numbers less than one.

(11-21-2019 05:52 PM)burkhard Wrote:  It's clear that what you are trying to do is floating-point arithmetic with numbers that are not base 10 (specifically base two).

That's (I think) a pretty unusual requirement. May I ask what the application is for?

When people talk about a calculator working in binary or hex, it's generally assumed that it's integer math involved, not floating-point. Your case is an exception...

I'm more of a mathematician than an engineer.

Anyway, the germination of this idea came from Continued Fractions, Cantor's Set and from the fact that #0.010101...b approaches 1/3. This latter property can be used to trisect an angle with compass and straightedge ... at least to the extent of generating a sequence of angles which converges to 1/3 of the original angle.

Part of everyone's education is an understanding of decimal notation and an extension to bases other than 10. No one ever told me this only applies to integers.


RE: Any Binary Calculators - KeithB - 11-21-2019 07:06 PM

Generally, non-floating-point binary fractions are just handled as "fixed point". For example you might take your 32 bit number and assume the decimal point is the 16th bit. Addition and subtraction are handled normally, but for multiplication and division you might have to shift the result to get the decimal back where it belongs, just like multiplying by hand.

This is done on small, low power MCU's where floating point might be too expensive time-wise.


RE: Any Binary Calculators - burkhard - 11-21-2019 08:32 PM

(11-21-2019 07:06 PM)KeithB Wrote:  Generally, non-floating-point binary fractions are just handled as "fixed point". For example you might take your 32 bit number and assume the decimal point is the 16th bit. Addition and subtraction are handled normally, but for multiplication and division you might have to shift the result to get the decimal back where it belongs, just like multiplying by hand.

This is done on small, low power MCU's where floating point might be too expensive time-wise.

Exactly. And the real math going on is a 32-bit integer.

I think what Kaliuzhkin seeks is perfectly legitimate although it's a pretty unusual request. To most engineers indeed "binary math" implies binary integer math. One can argue the merits of the jargon, but when he asked the question, that's what the initial respondents assumed.

So, anyhow... it sounds like there are some programs out there to do what he wants, but it doesn't sound like it's native to any of the present and past HP calculators.

Interesting question!


RE: Any Binary Calculators - Claudio L. - 11-21-2019 11:38 PM

(11-21-2019 08:32 PM)burkhard Wrote:  
(11-21-2019 07:06 PM)KeithB Wrote:  Generally, non-floating-point binary fractions are just handled as "fixed point". For example you might take your 32 bit number and assume the decimal point is the 16th bit. Addition and subtraction are handled normally, but for multiplication and division you might have to shift the result to get the decimal back where it belongs, just like multiplying by hand.

This is done on small, low power MCU's where floating point might be too expensive time-wise.

Exactly. And the real math going on is a 32-bit integer.

I think what Kaliuzhkin seeks is perfectly legitimate although it's a pretty unusual request. To most engineers indeed "binary math" implies binary integer math. One can argue the merits of the jargon, but when he asked the question, that's what the initial respondents assumed.

So, anyhow... it sounds like there are some programs out there to do what he wants, but it doesn't sound like it's native to any of the present and past HP calculators.

Interesting question!

I agree with both. But if the OP needs to work with binary numbers with fractional parts, on a HP48 and newer should be easy to convert real numbers to "fractional" binary numbers as long as the desired number of bits is <64
Just decide how many fractional bits you need (let's call it 'f') and convert to integers: IP(R) and IP(FP(R)*2^f), both of them can be displayed in binary, even converted to a string with the format "010101.10101".

Just a couple of short routines and I'd say the entire line of RPL HP calculators can easily support fractional binary numbers. The only catch is you can display them, but not operate on them since all operations are decimal. Results in binary may not correspond to the results obtained if using binary math of course. The HP Prime could do this using binary math, so it might even achieve this too.