#include <iostream>
int main() 
{ 
    int val = std::stof("4.99") * 100; 
    std::cout << val; 
    return 0; 
}
I've tried other strings and they all seem to be converting correctly, but I am not sure what is happening behind the scenes that is causing this to output 498 instead of 499. In my use case, every string has a maximum of 2 decimal places.
 
     
    