SDS_SCALE_DATA(3)



NAME

     sds_scale_data - linear re-scaling of sds data


SYNOPSIS

     #include <soi_sds.h>
     int sds_scale_data(SDS *sds, double scale, double bias)


DESCRIPTION

     sds_scale_data rescales the sds data values according to the
     rule:

     new_value = (scale * current_value) + bias

     If there are any rescaled  data  values  outside  the  range
     representable  in  the  data  type, they are replaced by +/-
     Infinity if the data are floating-point, or by the bit  pat-
     tern  encoding  missing  or  invalid  data  if  the data are
     fixed-point.

     If the sds contains advisory scaling on output  information,
     then  the  existing  scaling parameters are adjusted accord-
     ingly.


DIAGNOSTICS

     If the data are of a  type  which  cannot  be  converted  to
     floating-point  by sds_data_convert, no values are modified,
     the function returns UNSUPPORTED_DATATYPE, and soi_errno  is
     set.

     If any re-scaled data are out of range the function  returns
     DATA_OUT_OF_RANGE; otherwise the function returns 0.


FILES


SEE ALSO

     sds_data_convert(3), sds_set_scaling(3)


BUGS

     Fixed-point data are converted to floating-point by  a  call
     to  sds_data_convert before scaling, and then converted back
     to their original type by the same function;  therefore  any
     bugs or limitations of that function also apply here.

     If the function is called with scale = 0, all data  will  be
     set  to  the constant value bias.  If output scaling parame-
     ters are set, their readjustment may cause a  divide  excep-
     tion, or cause them both to be set to Infinity.


HISTORY

     1998-01-27     SOI V. 2.8