In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion succeeds but the result value is implementation-dependent.

For the conversion of non-constant numeric values, the following rules apply:

In Go, you can convert from an integer type to a floating-point type. Therefore, there is no reason not to be forgiving.

Robustness principle

In computing, the robustness principle is a general design guideline for software:

Be conservative in what you do, be liberal in what you accept from others (often reworded as "Be conservative in what you send, be liberal in what you accept").

The principle is also known as Postel's law, after Internet pioneer Jon Postel, who wrote in an early specification of the Transmission Control Protocol that:1

TCP implementations should follow a general principle of robustness: be conservative in > what you do, be liberal in what you accept from others.

In other words, code that sends commands or data to other machines (or to other programs on the same machine) should conform completely to the specifications, but code that receives input should accept non-conformant input as long as the meaning is clear.