What would be the best/fastest way to convert Double A to Single B which would guarantee that when casting B back to Double the following is always true (with minimal loss of precision):
A>=(Double)B
(or <= in symmetrical case).
The assumption is that A range fits into Single.
Example:
double A = 1234.5678901234;
float B = (float) A; //2nd step - truncation occurs
double C = B;
I want to modify 2nd step in such way that for any value of A, always A>=C (or A<=C in symmetrical case).