Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Liutauras Vilda
• Bear Bibeault
• Paul Clapham
• Jeanne Boyarsky
Sheriffs:
• Junilu Lacar
• Knute Snortum
• Henry Wong
Saloon Keepers:
• Ron McLeod
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• Carey Brown
Bartenders:
• Frits Walraven
• Joe Ess
• salvin francis

# odd and even

Ranch Hand
Posts: 4702
9
• 1
does the concept of odd and even only apply to integers?
is 1.2 even?
is 1.3 odd?

Marshal
Posts: 67335
171

Wikipedia wrote:A formal definition of an even number is that it is an integer of the form n = 2k, where k is an integer; it can then be shown that an odd number is an integer of the form n = 2k + 1. This classification applies only to integers, i.e., non-integers like 1/2, 4.201, or infinity are neither even nor odd.

source

Randall Twede
Ranch Hand
Posts: 4702
9
ill bite. isn't 1.2 like 12?
I think maybe real numbers are odd or even.

author
Posts: 23850
141

Randall Twede wrote:
is 1.3 odd?

If 1.3 is odd, then is 1.30 even? ...

Henry

Bear Bibeault
Marshal
Posts: 67335
171
I agree with Wikipedia -- it makes no sense to try and apply the concept of odd/even to non-integers.

lowercase baba
Posts: 12781
51
I think you can apply even/odd to non-integers.  An even number is one where the remainder you get when dividing by 2 is 0.

So. 4.1 divided by 2 is 2, with 1/10th left over. this is not 0. So 4.1 is not even.

edit - I suppose an odd number is one where the remainder is exactly 1, so 4.1 is also not odd.

Marshal
Posts: 24819
60

Henry Wong wrote:If 1.3 is odd, then is 1.30 even? ...

And what about pi? We have to look at the last digit... 3 point 1 4 1 5... okay, this could take a while, I will post back when I find out.

Bartender
Posts: 9605
16
• 1

Henry Wong wrote:

Randall Twede wrote:
is 1.3 odd?

If 1.3 is odd, then is 1.30 even? ...

Henry

tim-and-eric-mind-blown.gif

Bartender
Posts: 3674
151

Paul Clapham wrote:

Henry Wong wrote:If 1.3 is odd, then is 1.30 even? ...

And what about pi? We have to look at the last digit... 3 point 1 4 1 5... okay, this could take a while, I will post back when I find out.

Stop counting. Pi is even since it is equal to 180. And so is pi / 2, but pi/4 is odd. Which is odd, since any other real or complex number is even.
Even more remarkable is that pi is a prime number, since it is not the product of any other primes. But the probability that I am serious is a genuine even number.

Marshal
Posts: 66960
255
It will be quicker if you calculate the digits backwards, starting with the last digit.

Randall Twede
Ranch Hand
Posts: 4702
9
you funny Piet
I like you already

Randall Twede
Ranch Hand
Posts: 4702
9
I have to agree with henry Wong. if 1.3 is odd is 1.30 even?

fred rosenberger
lowercase baba
Posts: 12781
51

Randall Twede wrote:I have to agree with henry Wong. if 1.3 is odd is 1.30 even?

Yes.

 I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad: Java file APIs (DOC, XLS, PDF, and many more) https://products.aspose.com/total/java