// Converts a Decimal to a float. Since a float has fewer significant // digits than a Decimal, this operation may produce round-off errors. // public static float ToSingle(Decimal d) { float result = 0.0f; // Note: this can fail if the input is an invalid decimal, but for compatibility we should return 0 DecCalc.VarR4FromDec(ref d, out result); return(result); }
// Converts a Decimal to a float. Since a float has fewer significant // digits than a Decimal, this operation may produce round-off errors. // public static float ToSingle(Decimal d) { return(DecCalc.VarR4FromDec(ref d)); }