Jump to content

Template talk:Hex2dec: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
Line 15: Line 15:
::::: Note that the documentation doesn't claim it works without the 0x prefix. So, I am not sure if this is "broken", or perhaps you just want the addition of another feature? I could certainly add some logic to test to see if the 0x prefix exists, but is that necessary? [[User:Plastikspork|Plastikspork]] [[User talk:Plastikspork|<sub style="font-size: 60%">―Œ</sub><sup style="margin-left:-3ex">(talk)</sup>]] 22:30, 10 September 2010 (UTC)
::::: Note that the documentation doesn't claim it works without the 0x prefix. So, I am not sure if this is "broken", or perhaps you just want the addition of another feature? I could certainly add some logic to test to see if the 0x prefix exists, but is that necessary? [[User:Plastikspork|Plastikspork]] [[User talk:Plastikspork|<sub style="font-size: 60%">―Œ</sub><sup style="margin-left:-3ex">(talk)</sup>]] 22:30, 10 September 2010 (UTC)
::::::Yes the doc doesn't promise lowercase. So? That's a programmers-excuse. ''Every'' hex user knows: A=a. So let's not blame an editor for not writing a hex value in uppercase (and even if so: at least give an error-message). Oh please, hex2dec should accept as many input as possible. No excuses between us, good programmers as we are. -[[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 22:39, 10 September 2010 (UTC)
::::::Yes the doc doesn't promise lowercase. So? That's a programmers-excuse. ''Every'' hex user knows: A=a. So let's not blame an editor for not writing a hex value in uppercase (and even if so: at least give an error-message). Oh please, hex2dec should accept as many input as possible. No excuses between us, good programmers as we are. -[[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 22:39, 10 September 2010 (UTC)
{{od}} Please re-read what I wrote. It claims to work for lowercase, but it does not claim to work without the 0x prefix. Thanks! [[User:Plastikspork|Plastikspork]] [[User talk:Plastikspork|<sub style="font-size: 60%">―Œ</sub><sup style="margin-left:-3ex">(talk)</sup>]] 22:41, 10 September 2010 (UTC)


== E7 wrong ==
== E7 wrong ==

Revision as of 22:41, 10 September 2010

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]
Note that the documentation doesn't claim it works without the 0x prefix. So, I am not sure if this is "broken", or perhaps you just want the addition of another feature? I could certainly add some logic to test to see if the 0x prefix exists, but is that necessary? Plastikspork ―Œ(talk) 22:30, 10 September 2010 (UTC)[reply]
Yes the doc doesn't promise lowercase. So? That's a programmers-excuse. Every hex user knows: A=a. So let's not blame an editor for not writing a hex value in uppercase (and even if so: at least give an error-message). Oh please, hex2dec should accept as many input as possible. No excuses between us, good programmers as we are. -DePiep (talk) 22:39, 10 September 2010 (UTC)[reply]

Please re-read what I wrote. It claims to work for lowercase, but it does not claim to work without the 0x prefix. Thanks! Plastikspork ―Œ(talk) 22:41, 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]