Code covered by the BSD License  

Highlights from
ispair

1.5

1.5 | 2 ratings Rate this file 1 Download (last 30 days) File Size: 1.57 KB File ID: #15208

ispair

by Kling & Freitag GmbH

 

05 Jun 2007 (Updated 05 Jun 2007)

find if a natural number is pair or not...

| Watch this File

File Information
Description

from all the IS* functions from MATLAB I always missed this one...

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
05 Jun 2007 John D'Errico

I had no idea what was meant by the description for this file, nor for the help. What is a "pair" number? Does this perhaps refer to prime pairs? The help refers to an "impair" number. Do you need to input a pair of numbers? Sorry, but its quite confusing. I'd call the help a bit impaired.

Once you edit the file, you find out that all this does is to test if a number is even or odd, i.e., it is testing the parity of an integer. Its pretty trivial to do, but it is functionality that is already on the file exchange.

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=2006&objectType=file

Or, if you wish, just use this one line anonymous function:

iseven = @(x) mod(x,2) == 0;

06 Jun 2007 Luca Balbi

Trivial code, and misleading function name.
Should have been "iseven", badly translated from Italian/French/...

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
is Kling & Freitag GmbH 22 Oct 2008 09:14:38
pair Kling & Freitag GmbH 22 Oct 2008 09:14:38
impair Kling & Freitag GmbH 22 Oct 2008 09:14:38
general Kling & Freitag GmbH 22 Oct 2008 09:14:38
mathematics Kling & Freitag GmbH 22 Oct 2008 09:14:38

Contact us at files@mathworks.com