Skip to main content
19-Tanzanite
December 25, 2023
Solved

Conversion between DECimal, BINary, HEXAdecimal and OCTal numbers...?

  • December 25, 2023
  • 2 replies
  • 3013 views

Hello,

How will look like a function or multiple functions in Mathcad Prime so that when I give it a DECimal number to convert that DECimal number into BINary, HEXAdecimal, and OCTal corresponding values? Or how to do these things in Mathcad Prime?

Case a) Input: DECimal number, Output: BINary, HEXAdecimal and OCTal corresponding values/numbers
Case b) Input: BINary number, Output: DECimal, HEXAdecimal and OCTal corresponding values/numbers
Case c) Input: HEXAdecimal number, Output: DECimal, BINary and OCTal corresponding values/numbers
Case d) Input: OCTal number, Output: DECimal, BINary and HEXAdecimal corresponding values/numbers

Like it is shown below an example for Case a):

Cornel_0-1703491715810.png

 

Best answer by LucMeekes

You're right, there's an error in there that I didn't spot yet.

This one should work fine.

 

Success!
Luc

2 replies

24-Ruby III
December 25, 2023
23-Emerald IV
December 25, 2023

The attached file contains conversion routines between any radix.

You can convert from decimal to binary, octal, decimal and hexadecimal, and any other combination of two, but also to radix 3, 4, 5, 6, 7, 9, 11, 12, 13, 14, 15, 17...

 

And it works in any version of Prime >= 4.

 

Success!
Luc

 

 

Cornel19-TanzaniteAuthor
19-Tanzanite
December 25, 2023

Cornel_0-1703494299295.png

Cornel_2-1703494319384.png

 

Cornel_3-1703494329578.png

Why are different values between the two?

 

Cornel_0-1703495122459.png

Cornel_2-1703494960107.png

Cornel_0-1703495202692.png

LucMeekes23-Emerald IVAnswer
23-Emerald IV
December 25, 2023

You're right, there's an error in there that I didn't spot yet.

This one should work fine.

 

Success!
Luc