=3);
if (finite(p))
{
/* assign out-of-range values to sentinel values */
if (p>=3276.7) P=0x7fffL; else if (p<=-3276.7) P=0x8001L;
/* encode the pressure as the number of centibars (rounded) */
else P = (long int)(10*(p + ((p<0) ? -0.05 : 0.05)));
/* express in 16-bit 2's-complement form */
if (P<0) P+=0x10000L;
}
return P;
}
/*------------------------------------------------------------------------*/
/* function to encode salinity as a 2-byte unsigned long integer */
/*------------------------------------------------------------------------*/
/**
This function implements the hex-encoding of IEEE-formattted floating
point salinity data into 16-bit unsigned integers with 2's complement
representation. The encoding formula accounts for the full range of
32-bit IEEE floating point values but only values in the open range:
-4.095~~=3);
if (finite(s))
{
/* assign out-of-range values to sentinel values */
if (s>=61.439) S=0xefffL; else if (s<=-4.095) S=0xf001L;
/* encode the salinity as the number of parts-per-ten-million (rounded) */
else S = (long int)(1000*(s + ((s<0) ? -0.0005 : 0.0005)));
/* express in 16-bit 2's-complement form */
if (S<0) S+=0x10000L;
}
return S;
}
/*------------------------------------------------------------------------*/
/* function to encode temperature as a 2-byte unsigned integer */
/*------------------------------------------------------------------------*/
/**
This function implements the hex-encoding of IEEE-formattted floating
point temperature data into 16-bit unsigned integers with 2's complement
representation. The encoding formula accounts for the full range of
32-bit IEEE floating point values but only values in the open range:
-4.095~~