Assuming your C environment is doing 2 integer additions, it's a lot easier than it sounds.
typedef long s1516;
A view is a fixed point value with 16 bits of a fraction. This is the same as a rational number whose denominator is always 65536 (or 2 16 ). To form such a rational value from a floating point value, you simply multiply by the denominator. Then it is just a matter of suitable rounding and truncation of the integral type.
The standard chose the form they made because it only works if your system uses 2 additional integer arithmetic. Although it is true that the leftmost bit represents a sign, it is not a sign bit in the sense that is used in a floating point representation.
If your calculations are really a float , not a double , you will find that you do not have as much accuracy in your calculation as is available at a fixed point for numbers near full scale. If you calculate in double , then you will always have more accuracy in your calculation than in the result.
Edit:
Apparently, the latest specification is available from ICC as Specification ICC.1: 2004-10 (profile version 4.2.0.0) . Section 5.1.3:
5.1.3 s15Fixed16Number
A fixed signed 4-byte / 32-bit number that has 16 fractional bits, as shown in table 3.
Table 3 - s15Fixed16Number
Number encoding
-32768.0 80000000h
0 00000000h
1.0 00010000h
32767 + (65535/65536) 7FFFFFFFh
Besides the localized preference for the decimal point representation, these values ββare fully consistent with my understanding that the representation is just a signed integer, which must be divided by 65536 to get their values.
The natural conversion to representation is simply multiplied by 65536, and itβs easy to separate from it. Choosing the right rounding rule is a matter of preference.
The full scale range is from -32768.0 (0x80000000) to approximately 32767.9999847412 (0x7fffffff) inclusive.
I agree that it would be clearer if the specification had a hexadecimal representation of any negative values. I shot the entire document, and the only values ββI found in decimal and hexadecimal were the CIE XYZ color coordinates, which by definition range from 0 to 1 and therefore do not help as approximate negative values.