David Rinck
David Rinck

Reputation: 6986

Implicit Conversion from Double to Single

Dim BP As Single, WVP As Single, x As Single
...
x *= (101.325 / BP) * ( BP / (BP - WVP) )

The code compiles and seems to run correctly, but is underlined with the message "Implicit Conversion from 'Double' to 'Single'"

Why would this be an implicit conversion if each of the variables is cast as a Single? Is this something I should worry about or change?

Upvotes: 0

Views: 436

Answers (2)

SLaks
SLaks

Reputation: 887469

101.325 is a Double literal.
Therefore, your code is actually multiplying a Double by a Single, creating a Double.

You need to write 101.325F to force the literal to be a Single.

Upvotes: 4

msarchet
msarchet

Reputation: 15242

101.325 is a double, that is being cast to a single.

Upvotes: 0

Related Questions