Talk:Sum digits of an integer: Difference between revisions

From Rosetta Code
Content added Content deleted
(Output base)
 
Line 2: Line 2:


It looks like the base of the output is supposed to be 10. Does that matter at all? --[[User:Mwn3d|Mwn3d]] 12:59, 19 July 2012 (UTC)
It looks like the base of the output is supposed to be 10. Does that matter at all? --[[User:Mwn3d|Mwn3d]] 12:59, 19 July 2012 (UTC)
:I agree, for me reading the output as 29 or 0x1d would be the same. For the input the 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.--[[User:Nigel Galloway|Nigel Galloway]] 11:43, 20 July 2012 (UTC)

Revision as of 11:43, 20 July 2012

Output base

It looks like the base of the output is supposed to be 10. Does that matter at all? --Mwn3d 12:59, 19 July 2012 (UTC)

I agree, for me reading the output as 29 or 0x1d would be the same. For the input the 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.--Nigel Galloway 11:43, 20 July 2012 (UTC)