| Anonymous | Login | Signup for a new account | 2013-06-18 23:43 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0001817 | OCaml | OCaml general | public | 2003-09-05 03:31 | 2007-11-25 20:25 | ||||||
| Reporter | administrator | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | feature | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | |||||||||||
| Target Version | Fixed in Version | ||||||||||
| Summary | 0001817: Complex infinity/nan field values | ||||||||||
| Description | Full_Name: william margolis Version: 3.06 OS: linux (suse 8.1) Submission from: adsl-63-199-206-139.dsl.lsan03.pacbell.net (63.199.206.139) I love the Complex module, BUT: Objective Caml version 3.06 # 1/0;; Exception: Division_by_zero. # 1.0/.0.;; -: float = inf. # Complex.div Complex.one Complex.zero;; -:: Complex.t = {Complex.re = nan; Complex.im = nan.} I understand why this is occuring, according to the standard sequencing through the complex division algorithm. But, for people working on the Rieman sphere, it would be very, very pleasant if 1/0 could register as, say {Complex.re = infinity; Complex.im = 0.} or something similar !? This would certainly please extended-complex-plane people. (We expect a/0 = an infinity type, not an nan...) In any case, my desire is that I may be able to distinguish in the complex case between nan and infinity cases, without having to create, say: type sphere = INF | C of float * float ;; and do all the argument matching comparisons each time. Is there an easy/efficient implementation !? | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Relationships |
||||||
|
||||||
Notes |
|
|
(0004348) Christophe Troestler (reporter) 2007-11-25 01:04 edited on: 2007-12-01 11:04 |
It seems that the better one can do is to follow the ISO/IEC 9899:1999 standard, annex G (IEC 60559-compatible complex arithmetic (informative), pages 465–478. ANSI, 1999.). Then # Complex.div Complex.one Complex.zero;; - : Complex.t = {re = infinity; im = nan} which is an infinity because a complex number with any infinite component is considered infinite (the only complex NaN is { re = nan; im = nan }. I have uploaded the file "complex_test.ml" with an implementation of mul and div. See also: ftp://ftp.win.ua.ac.be/pub/preprints/03/criticism.pdf [^] |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| 2007-11-25 01:04 | Christophe Troestler | Note Added: 0004348 | |
| 2007-11-25 20:25 | Christophe Troestler | File Added: complex_test.ml | |
| 2007-12-01 11:04 | Christophe Troestler | Note Edited: 0004348 | |
| 2009-08-19 14:59 | xclerc | Relationship added | related to 0004748 |
| Copyright © 2000 - 2011 MantisBT Group |