Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2012-09-08 10:36:42

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Binary/Decimal/Hexadecimal Converter Testing

Have been rewriting my Binary/Decimal/Hexadecimal Converter from the ground up, using my "Full Precision" library.

Can you guys throw some different numbers at it to see how it performs?

Binary/Decimal/Hexadecimal Converter - Test Version

Let me know any oddities, cheers!


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#2 2012-09-08 10:50:30

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi MIF;

So far it looks pretty good.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2012-09-08 16:59:05

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

Excellent ... so far smile


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#4 2012-09-08 19:55:19

Bob
Administrator
Registered: 2010-06-20
Posts: 10,010

Re: Binary/Decimal/Hexadecimal Converter Testing

hi MathsIsFun

Tests out OK so far for me;  whole, fractional and negative.

smile smile smile

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#5 2012-09-08 20:24:03

Jai Ganesh
Administrator
Registered: 2005-06-28
Posts: 45,834

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi MathsIsFun,

The binary/decimal/hexa-decimal converter works very well!

Excellent, MathsIsFun!


It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.

Offline

#6 2012-09-09 00:08:30

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

Thanks.

Any suggestions for improvement?

I had someone email me asking for leading zeros, but it may look OK having 0010 as a binary, but what should that be as a decimal? 02? 002?


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#7 2012-09-09 00:39:45

Bob
Administrator
Registered: 2010-06-20
Posts: 10,010

Re: Binary/Decimal/Hexadecimal Converter Testing

Leading zeros:

That depends on what the user wants from the conversions.  I'd have thought that spaces to make a fixed 'byte' size might be more useful; thus:

0011 0101
234 567.234 456
FFFF FFFF

0001 0101.1111 1100
023 456 789.123 456 789
000F ABCD 1234.FFFF 6767 6700

So pad out the bin and hex to blocks of 4 with zeros front and rear and the decimal in similar blocks of 3.

btw.  These are 6 independent examples not 2 with conversions.  smile

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

#8 2012-09-09 02:52:05

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi MIF;

Maybe here is a good spot to indicate to the user a strange phenomenon that occurs in programming more than in mathematics.

If you enter .5374 in decimal you get

and

This might suggest that is the exact answer. If you carry more digits you get

and

(Pardon the lowercase letters, Mathematica thinks they are not worthy of Capitalization.)
You can continue this process because although .5374 terminates in base 10 it may not in other bases. For instance, 1 / 10 is .1 in base 10 but is non terminating in base 2. An ellipsis ... could be put to suggest that there are more digits.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#9 2012-09-09 03:26:29

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi MIF

The converter shows strange behavior when I try to put in "1.2." in the hexadecimal box with a dot after the 2. The output is okay for the binary number, but it is weird for the decimal conversion. Maybe you should just disallow adding 2 dots altogether. The same goes for "e". Adding e's after the first changes the results.

There should also be a way to enter recurring decimals.

Otherwise, it is a very nice piece of work (like every other Flash "app" you made smile ).


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#10 2014-03-27 15:48:04

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

A new test version needs testing: Binary/Decimal/Hexadecimal Converter - Test Version

I often get contacted by people who confuse "computer binary" (limited bits), with treating a binary number as a number. They insisting that "-1 decimal" should be "11111111 binary" (with the first bit being a sign bit), so I have tried to satisfy all comers with a drop-down box of common types.

The trouble is that it opens up many possible errors, so could you kind folk try out lots of things and tell me if they work for you?

Consider:
* positive/negative
* fractional values (like 1.1)
* changing binary, decimal or hex value
* as a number/8-bit/etc.

Cheers!


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#11 2014-03-27 20:45:41

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi MIF;

What is the difference between the menu item 0001 and number?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#12 2014-03-27 22:13:37

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

0001 is supposed to pad binary with zeros to make groups of 4 (so it matches hex)


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#13 2014-03-28 19:44:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi;

So far the signed 8 bit is working fine. Doing more testing of the others.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#14 2014-03-28 19:46:47

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

Thanks for that.


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#15 2014-03-28 19:49:40

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi;

It will take some time with the 16bit signed  integers and fractions.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#16 2014-03-29 13:12:15

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi MIF;

Are you using a two's complement for your negative numbers?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#17 2014-03-29 13:13:07

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

Yes, I believe that is the standard in computing.


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#18 2014-03-29 13:27:15

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi;

Everything working all the way to the signed 32 bits for integers. Will keep checking and then to decimals.

I am fairly confident in the results except I have not checked negative signed 32 bit floats.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#19 2014-04-01 15:40:34

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: Binary/Decimal/Hexadecimal Converter Testing

That is really kind of you, thanks.

So it is nearly ready to go live (and replace the existing one).


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#20 2014-04-01 20:02:46

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Binary/Decimal/Hexadecimal Converter Testing

Hi;

I would like to try one more thing but I will require your help. I can not find a good description of the implementation of signed 32 bit for floats like 45.567 etc. I am using everything left of the rightmost bit is inverted. Can you explain yours?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB