Skip to content

proposal: spec: add Posit data type #33205

@jfcg

Description

@jfcg

Posits are gaining traction as a replacement and clean improvement over IEEE 754. They offer reasonable dynamic ranges with better accuracy / energy efficiency / speed on many applications. They will probably replace IEEE floats in 5 to 10 years in cpus / gpus / tpus. They have an official standard.

Adding (experimental) support for posits will position Go 2 in a better place for developers' consideration who want to get better results out of their mathematical calculations in AI, ML, HPC, weather forecasting, astrophysics etc. areas in addition to typical backend programming that Go is already good at. This will possibly enable Go's penetration into scientific computing.

At the moment there is no hw architecture that supports posits, but there are many sw and fpga implementations. Initially it could start like soft-floats. As hw support becomes available, people will reap the benefits. Most floating-point code is readily convertable to posits: just rename data types.

Adding posits is non-trivial and a BIG step. It has to be done incrementally. Also there will possibly be a transition period where hw platforms will have IEEE floats and / or posits.

These are the (incomplete) steps of this proposal:

  • add posit8, posit16, posit32, posit64 data types as per the standard
  • add conversions from/to other data types
  • add "printing/scanning posits" functionality to fmt library
  • add math/posit standard library with standard Sine/Tan etc. (posit32)
  • add cxposit32, cxposit64, cxposit128 complex number data types
  • add math/cmplx/cxposit standard library (cxposit64)

There is a lot to do, so when hw support arrives, Go 2 will be ready to deliver ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions