FUNCTION  fMathGetBin

Returns the value at the center of the bin where @x falls in, given a grid of @NumBin bins in the interval @x1 to @x2.

Parameters:
  • @x float: value of the variable.
  • @x1 float: lower bound of the interval.
  • @x2 float: upper bound of the interval.
  • @NumBin int: number of bins in which the inteval is partitioned.
  • @HasOpenUpperBound bit: true if the bins have open upper bounds (and closed lower bounds); false if the bins have open lower bounds (and closed upper bounds).
  • returns BinCenter float: the center of the bin, where @x falls in.
    select dbo.fMathGetBin( s.z,0.1,0.7,24,0) as BinCenter, count(*) as Counts from SpecPhoto as s where primtarget&(0x04000020)!=0 and primtarget&(64|128|256)=0 and z between 0.1 and 0.7 group by dbo.fMathGetBin(s.z,0.1,0.7,24,0) order by dbo.fMathGetBin(s.z,0.1,0.7,24,0)
    see also spMathHistogramNDim
  • Input and output parameters

    nametypelengthinoutpnum
    @NumBinint4input4
     float8input0
    @xfloat8input1
    @x1float8input2
    @x2float8input3
    @HasOpenUpperBoundbit1input5