| Type | Bug | Status | submitted | Date | 20-Jun-2010 09:52 |
|---|---|---|---|---|---|
| Version | alpha 99 | Category | Unspecified | Submitted by | Ladislav |
| Platform | All | Severity | minor | Priority | normal |
| Summary | EVEN?, ODD? and decimals |
|---|---|
| Description |
I consider a value to be even only if it is an integral multiple of two. This means, that for me, 2.1 is not even. This, begs a question, how the ODD? function shall be defined, there are two alternatives: 1) ODD? means the same as NOT EVEN?, in this case, 2.1 would need to be odd 2) ODD? means, that the value is: 2.1) integral (having zero remainder when divided by 1.0) 2.2) not even , in this case 2.1 would need to be neither even nor odd |
| Example code |
>> even? 2.1 == true |
| Assigned to | n/a | Fixed in | - | Last Update | 25-Jun-2010 08:55 |
|---|
| Comments | |
|---|---|
|
(0002398)
Ladislav 25-Jun-2010 08:55 |
To be even more specific, here are my alternative functions to consider:
alternative-even?: func [ number [decimal!] ] [ zero? number // 2.0 ] alternative-odd?: func [ number [decimal!] ] [ found? all [ zero? number // 1.0 not zero? number // 2.0 ] ] ; some results: >> alternative-even? 2.1 == false >> alternative-even? 2.0 == true >> alternative-odd? 2.0 == false >> alternative-odd? 2.1 == false >> alternative-odd? 1.1 == false >> alternative-odd? 1.0 == true |
| Date | User | Field | Action | Change |
|---|---|---|---|---|
| 25-Jun-2010 08:55 | Ladislav | Comment : 0002398 | Added | - |
| 20-Jun-2010 09:55 | Ladislav | Description | Modified | - |
| 20-Jun-2010 09:53 | Ladislav | Summary | Modified | EVEN? and decimals => EVEN?, ODD? and decimals |
| 20-Jun-2010 09:53 | Ladislav | Description | Modified | - |
| 20-Jun-2010 09:53 | Ladislav | Code | Modified | - |
| 20-Jun-2010 09:52 | Ladislav | Ticket | Added | - |