Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-290087: Invalid "Type cast is redundant"

$
0
0
Reporter porges (porges) porges (porges)
Created Mar 15, 2012 3:25:59 AM
Updated Mar 15, 2012 3:25:59 AM
Priority Normal
Type Unspecified
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
In the following code:

            string value = "0.01";
            float convertedValue = float.Parse(value);
            Console.WriteLine((int)((float)(convertedValue * 100.0f)));


R# marks the "float" cast as redundant. It is not. Removing it changes the result, as the intermediate value is no longer converted to float32 before conversion to int.

Viewing all articles
Browse latest Browse all 106942

Trending Articles