-
Couldn't load subscription status.
- Fork 18.4k
Closed
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageProposal
Milestone
Description
This proposal extends the Go programming language to include quaternions, a hypercomplex noncommutative division algebra that generalizes the complex numbers to four dimensions. They're particularly useful for representing spatial rotations, such as in 3D graphics.
Quaternions are generally represented in the form a + bi + cj + dk, where a, b, c, and d are real numbers, and i, j, and k are the fundamental imaginary units satisfying i2 = j2 = k2 = ijk = -1.
Concretely, this proposal changes the language as follows:
- Generalizes imaginary literals to include
jandksuffixes. - Extends numeric constants to include quaternion constants.
- Defines new numeric types for
quaternion128andquaternion256(and predeclares them). - Extends the unary and binary
+and-operators and the binary*operator to apply to quaternions. - Defines a new
quaternionbuilt-in function to construct quaternions from four real numbers. - Extends the
realandimagbuilt-in functions to also return the real and i-imaginary parts of quaternions. - Defines new
jmagandkmagbuilt-in functions to return the j- and k-imaginary parts of quaternions.
Also, it implies corresponding support and extensions to standard library packages.
rasky, dsnet, 4ad, zedkipp, Soreil and 50 morejrwren, wrq, futurechallenger and arturo182valyala, josharian, 4ad, rsc, bradfitz and 23 morerasky, griesemer, dsnet, valyala, 4ad and 17 morerasky, dsnet, 4ad, josharian, rsc and 13 more
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeLanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageProposal