#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double d_total = 1.2345678;
float f_total = (float)d_total;
double some_dbl = 6.7809123;
double actual = (d_total * some_dbl);
float no_cast = (float)(f_total * some_dbl);
float with_cast = (float)(f_total * (float)some_dbl);
cout << "actual: " << setprecision(25) << actual << endl;
cout << "no_cast: " << setprecision(25) << no_cast << endl;
cout << "with_cast: " << setprecision(25) << with_cast << endl;
cout << "no_cast, nextafter: " << setprecision(25) << nextafter(no_cast, 500.0f) << endl;
cout << endl;
cout << "Diff no_cast: " << setprecision(25) << actual - no_cast << endl;
cout << "Diff with_cast: " << setprecision(25) << with_cast - actual << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPGNtYXRoPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cglkb3VibGUgZF90b3RhbCA9IDEuMjM0NTY3ODsKCWZsb2F0IGZfdG90YWwgPSAoZmxvYXQpZF90b3RhbDsKCWRvdWJsZSBzb21lX2RibCA9IDYuNzgwOTEyMzsKCQoJZG91YmxlIGFjdHVhbCA9IChkX3RvdGFsICogc29tZV9kYmwpOwoJZmxvYXQgbm9fY2FzdCA9IChmbG9hdCkoZl90b3RhbCAqIHNvbWVfZGJsKTsKCWZsb2F0IHdpdGhfY2FzdCA9IChmbG9hdCkoZl90b3RhbCAqIChmbG9hdClzb21lX2RibCk7CgkKCWNvdXQgPDwgImFjdHVhbDogICAgICAgICAgICAgICAiIDw8IHNldHByZWNpc2lvbigyNSkgPDwgYWN0dWFsIDw8IGVuZGw7Cgljb3V0IDw8ICJub19jYXN0OiAgICAgICAgICAgICAgIiA8PCBzZXRwcmVjaXNpb24oMjUpIDw8IG5vX2Nhc3QgPDwgZW5kbDsKCWNvdXQgPDwgIndpdGhfY2FzdDogICAgICAgICAgICAiIDw8IHNldHByZWNpc2lvbigyNSkgPDwgd2l0aF9jYXN0IDw8I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