Talk:Test integerness: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 12: Line 12:
:::REXX considers 1.00 and 1e27 to be integers as long as Numeric Digits is large enough. ok? --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 19:12, 21 June 2014 (UTC)
:::REXX considers 1.00 and 1e27 to be integers as long as Numeric Digits is large enough. ok? --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 19:12, 21 June 2014 (UTC)
::::I'm not sure I understand the problem. 1.00 and 1e27 *are* integers. They may be stored as floating point numbers, but they are integers.--[[User:Grondilu|Grondilu]] ([[User talk:Grondilu|talk]]) 01:11, 22 June 2014 (UTC)
::::I'm not sure I understand the problem. 1.00 and 1e27 *are* integers. They may be stored as floating point numbers, but they are integers.--[[User:Grondilu|Grondilu]] ([[User talk:Grondilu|talk]]) 01:11, 22 June 2014 (UTC)

On second thought, the test makes sense with complex numbers. Basically a complex number is an integer if its real part is integer and its imaginary part is nul.--[[User:Grondilu|Grondilu]] ([[User talk:Grondilu|talk]]) 08:04, 22 June 2014 (UTC)

Revision as of 08:04, 22 June 2014

Some thoughts

  1. We also have: Determine if a string is numeric
  2. What does integerness mean? would "Have no imaginary part(s) and nothing* after the decimal point" do?
(At least for ints, reals, complex, and Quaternion types; not sure about infinities and whatnot).
*Note, .999... === 1 though.

--Paddy3118 (talk) 16:54, 18 June 2014 (UTC)

Thanks for clarifying the task. --Paddy3118 (talk) 12:11, 21 June 2014 (UTC)
An integer is an element of Z. Complex numbers, quaternions etc do no qualify as integers even if their real components are integers. There would be some sense in considering them so, but it's not the case mostly for historical reasons I guess.
To make the task clearer, I'll add a link to the Wikipedia article. Hope that helps.--Grondilu (talk) 13:50, 21 June 2014 (UTC)
REXX considers 1.00 and 1e27 to be integers as long as Numeric Digits is large enough. ok? --Walterpachl (talk) 19:12, 21 June 2014 (UTC)
I'm not sure I understand the problem. 1.00 and 1e27 *are* integers. They may be stored as floating point numbers, but they are integers.--Grondilu (talk) 01:11, 22 June 2014 (UTC)

On second thought, the test makes sense with complex numbers. Basically a complex number is an integer if its real part is integer and its imaginary part is nul.--Grondilu (talk) 08:04, 22 June 2014 (UTC)