fixed
Signed 24.8 decimal numbers. It is a signed decimal type which offers
a sign bit, 23 bits of integer precision and 8 bits of decimal
precision. This is exposed as an opaque struct with conversion helpers
to and from double and int on the C API side.
Here's the code I have:
http://play.golang.org/p/hhnKHAtnaR
This comes from https://github.com/mortdeus/gowl
I tweaked the test so that it would fail if the conversion to and from
fixed didn't work. The conversion between int and fixed works great,
but the conversion between float64 and fixed is less than the original
value. Is this to be expected? The C code that does this for wayland
can be found here:
http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-util.h
and the test for that code is here:
http://cgit.freedesktop.org/wayland/wayland/tree/tests/fixed-test.c
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.