Invalid float cast
Detects out-of-range casts to, from, or between floating-point types.
Overview
Use this check to detect out-of-range casts to, from, or between floating-point types. Invalid casts have undefined behavior, and typically yield arbitrary values. These values may differ from platform to platform. Available in Xcode 9 and later.
Invalid assignment of a double to a float in C
The cast from n to m results in undefined behavior because the destination type can’t represent its value.
double n = 10e50;
float m = (float)n; // Error: 10e50 can't be represented as a float.Solution
Use a different destination type or avoid the cast altogether.
See Also
Undefined Behavior Sanitizer
Misaligned pointerInvalid Boolean valueOut-of-bounds array accessInvalid enumeration valueReaching of unreachable pointDynamic type violationDivision by zeroNonnull argument violationNonnull return value violationNonnull variable assignment violationNull reference creation and null pointer dereferenceInvalid object sizeInvalid shiftInteger overflowInvalid variable-length array