Jump to content

Template talk:Hex2dec

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by DePiep (talk | contribs) at 22:23, 10 September 2010 (Lowercase can give different result: eh, I struck. This one is not solved yet.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Lowercase can give different result

Resolved
 – & we must accept wikimedia's limited thing/king

Please compare:

  • {{hex2dec|A9}} --> 169
  • {{hex2dec|a9}} --> 169
  • {{hex2dec|0xA9}} --> 169
  • {{hex2dec|0xa9}} --> 169

So when the "0x"-prefix is missing, the lowercase gives a different (and incorrect) result. So I put the disputed-tag on it. Other input might give the correct result (as I have noticed). Inputting a straight valid hex value like "a9" should be possible. -DePiep (talk) 19:01, 7 September 2010 (UTC)[reply]

Template Template:Hex2rgb(edit talk links history) uses this one, and also has this error. Tagged & talked there too. -DePiep (talk) 10:22, 8 September 2010 (UTC)[reply]
I fixed that one, I will see if I can fix this one. Plastikspork ―Œ(talk) 21:58, 10 September 2010 (UTC)[reply]
Solved, somehow. The source of the problem is untouched! Hex2dec is a deep template (nesting about say 16 levels, innit). That is expensive, we only got 40 levels. But if it works, than let's go with it (and pray for Wikimedia to give us some string-parsing functions). -DePiep (talk) 22:18, 10 September 2010 (UTC)[reply]
I was incorrect, and struck: this template is not solved. -DePiep (talk) 22:22, 10 September 2010 (UTC)[reply]

E7 wrong

  • {{hex2dec|E7}} --> 231 OK, As we expect (23110=E716)

Now please look at this:

  • {{hex2dec|00D7}} --> 215
  • {{hex2dec|00E7}} --> 231
  • {{hex2dec|00F7}} --> 247

These are neighbors in hex-language:

  • {{hex2dec|00E6}} --> 230
  • {{hex2dec|00E7}} --> 231
  • {{hex2dec|00E8}} --> 232

Alikes:

  • {{hex2dec|00E7}} --> 231
  • {{hex2dec|01E7}} --> 487
  • {{hex2dec|02E7}} --> 743
  • {{hex2dec|06E7}} --> 1767
  • {{hex2dec|07E7}} --> 2023
  • {{hex2dec|08E7}} --> 2279
  • {{hex2dec|09E7}} --> 2535
  • {{hex2dec|0AE7}} --> 2791
  • {{hex2dec|0FE7}} --> 4071

Another check:

  • {{hex2dec|00E7}} --> 231
  • {{hex2dec|0E7}} --> 231
  • {{hex2dec|E7}} --> 231
Anyone?

-DePiep (talk) 20:44, 10 September 2010 (UTC) Added more examples. -DePiep (talk) 20:59, 10 September 2010 (UTC)[reply]

Ah, at I myself: the "E7" is read as "exponent" 7 etc. So 0 * 10^7 = zero.
-DePiep (talk) 21:14, 10 September 2010 (UTC) (moved location)- DePiep (talk) 21:14, 10 September 2010 (UTC)[reply]
Okay, this should be fixable. I will see what I can do. Plastikspork ―Œ(talk) 21:59, 10 September 2010 (UTC)[reply]