S
Sim Nanda
Hello All,
I'm looking for a data class that can take a
floating point input and round it to the nearest
float based on a predefined set of boundaries.
In other words, an arbitrary float comes in and only
a discrete set of floats come out.
Something to the effect of----
//Given the float breakpoints,
float boundaries[] = {
11.5
,22.0
,24.0
,28.0
,39.0
};
//And the following code
DiscreteRange discreteFloat(boundaries);
discreteFloat.set(26.0);
float floatAnswer = discreteFloat.get();
//Here the 'floatAnswer' would equal 28.0
Anyone know of a class (set of classes) that already provides such
functionality? I've searched the web, but I don't think I'm
using the right terminology for such a critter. It'd be nice
if it was a template, and allowed for rounding up or down.
Any suggestions??
And it seems trivial, but if it already exists
and has been tested...why reinvent.
Happy Friday,
Slarty
I'm looking for a data class that can take a
floating point input and round it to the nearest
float based on a predefined set of boundaries.
In other words, an arbitrary float comes in and only
a discrete set of floats come out.
Something to the effect of----
//Given the float breakpoints,
float boundaries[] = {
11.5
,22.0
,24.0
,28.0
,39.0
};
//And the following code
DiscreteRange discreteFloat(boundaries);
discreteFloat.set(26.0);
float floatAnswer = discreteFloat.get();
//Here the 'floatAnswer' would equal 28.0
Anyone know of a class (set of classes) that already provides such
functionality? I've searched the web, but I don't think I'm
using the right terminology for such a critter. It'd be nice
if it was a template, and allowed for rounding up or down.
Any suggestions??
And it seems trivial, but if it already exists
and has been tested...why reinvent.
Happy Friday,
Slarty