Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex infinity/nan field values #8267

Closed
vicuna opened this issue Sep 5, 2003 · 3 comments
Closed

Complex infinity/nan field values #8267

vicuna opened this issue Sep 5, 2003 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Sep 5, 2003

Original bug ID: 1817
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: standard library
Tags: patch
Related to: #4748
Monitored by: @Chris00

Bug 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 !?

File attachments

@vicuna
Copy link
Author

vicuna commented Nov 25, 2007

Comment author: @Chris00

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

@github-actions
Copy link

github-actions bot commented May 6, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 6, 2020
@stedolan stedolan removed the Stale label May 12, 2020
@stedolan stedolan self-assigned this May 12, 2020
@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants