Talk:Sum digits of an integer: Difference between revisions

(→‎Input base: Doesn't matter.)
 
Line 17:
 
::But the sum of the '''binary''' ''digits' 10 expressed as a decimal is the sum of ''digits'' 10 in ''any'' valid base when expressed as a decimal, i.e. a one plus a zero equals one! --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 06:59, 30 January 2015 (UTC)
:The input BASE parameter defines how the function interprets the number. Within the computer 0xfe or 254 would both have the same binary representation. I hope that SumDigits(0xfe, 10) would return 11 and that SumDigits(254, 16) would return 29. In the example above in base 35 z would sum to z (35 in base 10), z in base 10 (35) would sum to 8.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:16, 30 January 2015 (UTC)
2,171

edits