Avoid passing float argument for "%f" printf specifier
"%f" takes a double. Eliminates some -Wdouble-promotion warnings.
This commit is contained in:
@@ -146,8 +146,8 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
|
||||
text_output << d << "\n";
|
||||
std_file_output << d << "\n";
|
||||
|
||||
float f = (float)0.00001;
|
||||
tmp.Printf( "Float: %f\n", f );
|
||||
float f = 0.00001f;
|
||||
tmp.Printf( "Float: %f\n", double(f) );
|
||||
textCtrl.WriteText( tmp );
|
||||
text_output << f << "\n";
|
||||
std_file_output << f << "\n";
|
||||
@@ -177,7 +177,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
|
||||
textCtrl.WriteText( tmp );
|
||||
|
||||
std_file_input >> f;
|
||||
tmp.Printf( "Float: %f\n", f );
|
||||
tmp.Printf( "Float: %f\n", double(f) );
|
||||
textCtrl.WriteText( tmp );
|
||||
|
||||
char std_buf[200];
|
||||
@@ -207,7 +207,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
|
||||
textCtrl.WriteText( tmp );
|
||||
|
||||
text_input >> f;
|
||||
tmp.Printf( "Float: %f\n", f );
|
||||
tmp.Printf( "Float: %f\n", double(f) );
|
||||
textCtrl.WriteText( tmp );
|
||||
|
||||
text_input >> str;
|
||||
|
@@ -224,7 +224,7 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
|
||||
m_listbox->Append(wxString::Format("integer value: %d", g_data.m_intValue));
|
||||
m_listbox->Append(wxString::Format("small int value: %u", g_data.m_smallIntValue));
|
||||
m_listbox->Append(wxString::Format("double value: %.3f", g_data.m_doubleValue));
|
||||
m_listbox->Append(wxString::Format("percent value: %.4f", g_data.m_percentValue));
|
||||
m_listbox->Append(wxString::Format("percent value: %.4f", double(g_data.m_percentValue)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user