proposal: golang.org/x/image/math/fixed: a place for fixed-point types.

209 views
Skip to first unread message

Nigel Tao

unread,
Jul 28, 2015, 6:36:20 AM7/28/15
to golang-dev, Rob 'Commander' Pike, Andrew Gerrand
I propose to create a new golang.org/x/image/math/fixed package for
common fixed-point types to be used by Go graphics libraries, whether
on golang.org/x, github.com, or anywhere else.

This would be analogous to how golang.org/x/image/math/f64 holds
common vector and matrix types for Go graphics libraries.

Specifically, the types would be:

----

package fixed

// Int26 is a 26.6 fixed point number.
type Int26 int32

// Int52 is a 52.12 fixed point number.
type Int52 int64

----

Read (not much more) about it at https://github.com/golang/go/issues/11906

Brendan Tracey

unread,
Jul 28, 2015, 11:03:03 AM7/28/15
to Nigel Tao, golang-dev, Rob 'Commander' Pike, Andrew Gerrand
This is in /x/image/math/fixed instead of /x/math/fixed because it only supports specific fixed point numbers and is not a general fixed point package?
> --
> You received this message because you are subscribed to the Google Groups "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Nigel Tao

unread,
Jul 28, 2015, 7:58:57 PM7/28/15
to Brendan Tracey, golang-dev, Rob 'Commander' Pike, Andrew Gerrand
On Wed, Jul 29, 2015 at 1:02 AM, Brendan Tracey
<tracey....@gmail.com> wrote:
> This is in /x/image/math/fixed instead of /x/math/fixed because it only supports specific fixed point numbers and is not a general fixed point package?

I prefer to keep the proposal discussion on the issue at
https://github.com/golang/go/issues/11906 but while I'm here...

It's really in x/image/math instead of x/math because x/math does not
exist, and it doesn't seem worth creating it just for a tiny package,
and I anticipate that most of the use of x/image/math/fixed is for
graphics-related things.

But, yes, there will only be two specific types in this package, and
it isn't intended to support arbitrary M.N fixed point numbers.
Reply all
Reply to author
Forward
0 new messages