1MS_GENFACTMULT(3)          Library Functions Manual          MS_GENFACTMULT(3)
2
3
4

NAME

6       ms_genfactmult - Generate SEED sample rate factor and multiplier
7
8

SYNOPSIS

10       #include <libmseed.h>
11
12       int  ms_genfactmult ( double samprate, int16_t *factor,
13                             int16_t *multiplier );
14
15       int  ms_ratapprox ( double real, int *num, int *den,
16                           int maxval, double precision );
17
18

DESCRIPTION

20       ms_genfactmult  generates  an  appropriate  SEED sample rate factor and
21       multiplier pair from a double precision sample rate.   If  samprate  is
22       positive it is expected to represent a rate in samples/second, if nega‐
23       tive is is expected to represent a period in seconds/sample.
24
25       Non-integer sample rates and periods are supported between 32767.0  and
26       1/32767.0.  An error will be returned for non-integer rates and periods
27       outside this range.
28
29       Integer sample rates and periods are supported between 1 and the  maxi‐
30       mum  possible value (32767 * 32767).  Values from 1 to 32767 are repre‐
31       sented directly.  Values larger than 32767 are factored and represented
32       exactly  when possible and approximated otherwise, with the discrepency
33       becoming larger as the values reach the maximum possible value.
34
35       The factor and multiplier are int16_t because that is the integer  size
36       needed for the fixed section of the SEED data header.
37
38       ms_ratapprox  finds  an  approximate rational number for a real through
39       continued fraction expansion.  Given a double precision real  the  rou‐
40       tine  tries to find a rational in numerator (num) and denominator (den)
41       form whose absolute values are not larger than maxval while  trying  to
42       reach a specified precision.
43
44

RETURN VALUES

46       ms_genfactmult returns 0 on success and -1 when value is outside of the
47       supported range or error.
48
49       ms_ratapprox returns the number of iterations performed.
50
51

AUTHOR

53       Chad Trabant
54       IRIS Data Management Center
55
56
57
58Libmseed API                      2016/10/07                 MS_GENFACTMULT(3)
Impressum