Skip to content

pi constant #4170

Closed
Closed

Description

@vicuna

Original bug ID: 4170
Reporter: Richard Jones
Assigned to: @garrigue
Status: resolved (set by @alainfrisch on 2016-12-07T17:42:27Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 3.09.2
Category: standard library
Related to: #5173
Monitored by: mehdi warwick @Chris00

Bug description

The stdlib should (IMHO) define a pi constant in Pervasives.

Activity

  1. vicuna commented on Jun 1, 2012

    @vicuna
    Author

    Comment author: @garrigue

    My standard code for pi is acos(-1.)
    Is this too long?

  2. vicuna commented on Jun 1, 2012

    @vicuna
    Author

    Comment author: Richard Jones

    Since you ask ...

    Is acos(-1.) the most accurate pi considering either the IEEE representation or the longer internal representation used by x86?

    I know that glibc defines this constant carefully so that the most accurate pi is used. (glibc also provides long-double -- 128 bit -- variants but I guess we can't use those in OCaml).

  3. vicuna commented on Oct 29, 2012

    @vicuna
    Author

    Comment author: warwick

    I suggested a similar thing in issue 005173. I think having a predefined value "pi" is a lot clearer than having to write acos(-1.) ... or acos(-.1.)

  4. vicuna commented on Dec 7, 2016

    @vicuna
    Author

    Comment author: @alainfrisch

    Sounds like a useful addition. A PR would be appreciated!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions