diff options
author | 2015-05-20 21:24:59 +0200 | |
---|---|---|
committer | 2015-05-20 21:24:59 +0200 | |
commit | f10abf48d7f3eddd91db264f30d0bfa581c921f4 (patch) | |
tree | 697d8a63c55e89cfa6194aae8a6edd4aa1142137 /src | |
parent | a082abcd7d85e6c851e7283eff917e8111a37413 (diff) |
Another round of -Wextra -Wdouble-promotion fixes. (nw)
Diffstat (limited to 'src')
34 files changed, 141 insertions, 137 deletions
diff --git a/src/emu/bus/isa/s3virge.c b/src/emu/bus/isa/s3virge.c index 7322783a021..f5065e8559e 100644 --- a/src/emu/bus/isa/s3virge.c +++ b/src/emu/bus/isa/s3virge.c @@ -269,7 +269,7 @@ void s3virge_vga_device::s3_define_video_mode() { // Dot clock is set via SR12 and SR13 // DCLK calculation - freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318f; // clock between XIN and XOUT + freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318; // clock between XIN and XOUT xtal = freq * 1000000; //printf("DCLK set to %dHz M=%i N=%i R=%i\n",xtal,s3.clk_pll_m,s3.clk_pll_n,s3.clk_pll_r); } diff --git a/src/emu/bus/isa/trident.c b/src/emu/bus/isa/trident.c index 2b122d5587a..03f646139be 100644 --- a/src/emu/bus/isa/trident.c +++ b/src/emu/bus/isa/trident.c @@ -315,7 +315,7 @@ int trident_vga_device::calculate_clock() m = tri.vid_clock & 0x007f; n = (tri.vid_clock & 0x0f80) >> 7; k = (tri.vid_clock & 0x1000) >> 12; - freq = ((double)(m+8) / (double)((n+2)*(pow(2.0,k)))) * 14.31818f; // there is a 14.31818MHz clock on the board + freq = ((double)(m+8) / (double)((n+2)*(pow(2.0,k)))) * 14.31818; // there is a 14.31818MHz clock on the board return freq * 1000000; } diff --git a/src/emu/cpu/drcbec.c b/src/emu/cpu/drcbec.c index 79329fb39bd..93e2d655ecf 100644 --- a/src/emu/cpu/drcbec.c +++ b/src/emu/cpu/drcbec.c @@ -1929,7 +1929,7 @@ int drcbe_c::execute(code_handle &entry) break; case MAKE_OPCODE_SHORT(OP_FRSQRT, 4, 0): // FSRSQRT dst,src1 - FSPARAM0 = 1.0f / sqrt(FSPARAM1); + FSPARAM0 = 1.0f / sqrtf(FSPARAM1); break; diff --git a/src/emu/cpu/i386/pentops.inc b/src/emu/cpu/i386/pentops.inc index 442a728fe54..34dad95afda 100644 --- a/src/emu/cpu/i386/pentops.inc +++ b/src/emu/cpu/i386/pentops.inc @@ -3634,18 +3634,18 @@ void i386_device::sse_rcpps_r128_rm128() // Opcode 0f 53 { UINT8 modrm = FETCH(); if( modrm >= 0xc0 ) { - XMM((modrm >> 3) & 0x7).f[0] = 1.0 / XMM(modrm & 0x7).f[0]; - XMM((modrm >> 3) & 0x7).f[1] = 1.0 / XMM(modrm & 0x7).f[1]; - XMM((modrm >> 3) & 0x7).f[2] = 1.0 / XMM(modrm & 0x7).f[2]; - XMM((modrm >> 3) & 0x7).f[3] = 1.0 / XMM(modrm & 0x7).f[3]; + XMM((modrm >> 3) & 0x7).f[0] = 1.0f / XMM(modrm & 0x7).f[0]; + XMM((modrm >> 3) & 0x7).f[1] = 1.0f / XMM(modrm & 0x7).f[1]; + XMM((modrm >> 3) & 0x7).f[2] = 1.0f / XMM(modrm & 0x7).f[2]; + XMM((modrm >> 3) & 0x7).f[3] = 1.0f / XMM(modrm & 0x7).f[3]; } else { XMM_REG src; UINT32 ea = GetEA(modrm, 0); READXMM(ea, src); - XMM((modrm >> 3) & 0x7).f[0] = 1.0 / src.f[0]; - XMM((modrm >> 3) & 0x7).f[1] = 1.0 / src.f[1]; - XMM((modrm >> 3) & 0x7).f[2] = 1.0 / src.f[2]; - XMM((modrm >> 3) & 0x7).f[3] = 1.0 / src.f[3]; + XMM((modrm >> 3) & 0x7).f[0] = 1.0f / src.f[0]; + XMM((modrm >> 3) & 0x7).f[1] = 1.0f / src.f[1]; + XMM((modrm >> 3) & 0x7).f[2] = 1.0f / src.f[2]; + XMM((modrm >> 3) & 0x7).f[3] = 1.0f / src.f[3]; } CYCLES(1); // TODO: correct cycle count } @@ -3972,12 +3972,12 @@ void i386_device::sse_rcpss_r128_r128m32() // Opcode f3 0f 53 { UINT8 modrm = FETCH(); if( modrm >= 0xc0 ) { - XMM((modrm >> 3) & 0x7).f[0] = 1.0 / XMM(modrm & 0x7).f[0]; + XMM((modrm >> 3) & 0x7).f[0] = 1.0f / XMM(modrm & 0x7).f[0]; } else { XMM_REG s; UINT32 ea = GetEA(modrm, 0); s.d[0]=READ32(ea); - XMM((modrm >> 3) & 0x7).f[0] = 1.0 / s.f[0]; + XMM((modrm >> 3) & 0x7).f[0] = 1.0f / s.f[0]; } CYCLES(1); // TODO: correct cycle count } diff --git a/src/emu/cpu/i860/i860dec.inc b/src/emu/cpu/i860/i860dec.inc index 9a3af87b783..c67515f5629 100644 --- a/src/emu/cpu/i860/i860dec.inc +++ b/src/emu/cpu/i860/i860dec.inc @@ -3365,7 +3365,7 @@ void i860_cpu_device::insn_frcp (UINT32 insn) { float v = get_fregval_s (fsrc2); float res; - if (v == 0.0) + if (v == 0.0f) { /* Generate source-exception trap if fsrc2 is 0. */ if (0 /* GET_FSR_FTE () */) @@ -3448,7 +3448,7 @@ void i860_cpu_device::insn_frsqr (UINT32 insn) { float v = get_fregval_s (fsrc2); float res; - if (v == 0.0 || v < 0.0) + if (v == 0.0f || v < 0.0f) { /* Generate source-exception trap if fsrc2 is 0 or negative. */ if (0 /* GET_FSR_FTE () */) @@ -3463,7 +3463,8 @@ void i860_cpu_device::insn_frsqr (UINT32 insn) { SET_FSR_SE (0); *((UINT32 *)&v) &= 0xffff8000; - res = (float)1.0/sqrt (v); + // FIXME: shouldn't this be 1.0f / sqrtf(v) ? + res = (float) (1.0/sqrt (v)); *((UINT32 *)&res) &= 0xffff8000; if (res_prec) set_fregval_d (fdest, (double)res); diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index b7ae47f8f8b..a7269110b06 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -2966,7 +2966,7 @@ inline void sh34_base_device::FSRRA(const UINT16 opcode) if (FP_RFS(n) < 0) return; - FP_RFS(n) = 1.0 / sqrtf(FP_RFS(n)); + FP_RFS(n) = 1.0f / sqrtf(FP_RFS(n)); } /* FSSCA FPUL,FRn PR=0 1111nnn011111101 */ @@ -2974,9 +2974,9 @@ void sh34_base_device::FSSCA(const UINT16 opcode) { UINT32 n = Rn; -float angle; + float angle; - angle = (((float)(m_fpul & 0xFFFF)) / 65536.0) * 2.0 * M_PI; + angle = (((float)(m_fpul & 0xFFFF)) / 65536.0f) * 2.0f * (float) M_PI; FP_RFS(n) = sinf(angle); FP_RFS(n+1) = cosf(angle); } diff --git a/src/emu/cpu/sharc/compute.inc b/src/emu/cpu/sharc/compute.inc index ac198c9bc15..880b368ad1f 100644 --- a/src/emu/cpu/sharc/compute.inc +++ b/src/emu/cpu/sharc/compute.inc @@ -741,7 +741,7 @@ void adsp21062_device::compute_fclip(int rn, int rx, int ry) { SHARC_REG r_alu; - if (FREG(rx) < fabs(FREG(ry))) + if (FREG(rx) < fabsf(FREG(ry))) { r_alu.f = FREG(rx); } @@ -749,11 +749,11 @@ void adsp21062_device::compute_fclip(int rn, int rx, int ry) { if (FREG(rx) >= 0.0f) { - r_alu.f = fabs(FREG(ry)); + r_alu.f = fabsf(FREG(ry)); } else { - r_alu.f = -fabs(FREG(ry)); + r_alu.f = -fabsf(FREG(ry)); } } diff --git a/src/emu/cpu/tms32082/mp_ops.c b/src/emu/cpu/tms32082/mp_ops.c index 48e60d827e8..eb59ca228f1 100644 --- a/src/emu/cpu/tms32082/mp_ops.c +++ b/src/emu/cpu/tms32082/mp_ops.c @@ -1428,7 +1428,7 @@ void tms32082_mp_device::execute_reg_long_imm() { float s1 = u2f(has_imm ? imm32 : m_reg[src1]); double s2 = u2d(m_fpair[rs >> 1]); - UINT64 res = d2u((double)(s1 + s2)); + UINT64 res = d2u((double) s1 + s2); m_fpair[rd >> 1] = res; break; } @@ -1436,7 +1436,7 @@ void tms32082_mp_device::execute_reg_long_imm() { double s1 = u2d(m_fpair[src1 >> 1]); float s2 = u2f(m_reg[rs]); - UINT64 res = d2u((double)(s1 + s2)); + UINT64 res = d2u(s1 + (double) s2); m_fpair[rd >> 1] = res; break; } @@ -1486,7 +1486,7 @@ void tms32082_mp_device::execute_reg_long_imm() { float s1 = u2f(has_imm ? imm32 : m_reg[src1]); double s2 = u2d(m_fpair[rs >> 1]); - UINT64 res = d2u((double)(s1 - s2)); + UINT64 res = d2u((double) s1 - s2); m_fpair[rd >> 1] = res; break; } @@ -1494,7 +1494,7 @@ void tms32082_mp_device::execute_reg_long_imm() { double s1 = u2d(m_fpair[src1 >> 1]); float s2 = u2f(m_reg[rs]); - UINT64 res = d2u((double)(s1 - s2)); + UINT64 res = d2u(s1 - (double) s2); m_fpair[rd >> 1] = res; break; } @@ -1544,7 +1544,7 @@ void tms32082_mp_device::execute_reg_long_imm() { float s1 = u2f(has_imm ? imm32 : m_reg[src1]); double s2 = u2d(m_fpair[rs >> 1]); - UINT64 res = d2u((double)(s1 * s2)); + UINT64 res = d2u((double)s1 * s2); m_fpair[rd >> 1] = res; break; } @@ -1552,7 +1552,7 @@ void tms32082_mp_device::execute_reg_long_imm() { double s1 = u2d(m_fpair[src1 >> 1]); float s2 = u2f(m_reg[rs]); - UINT64 res = d2u((double)(s1 * s2)); + UINT64 res = d2u(s1 * (double) s2); m_fpair[rd >> 1] = res; break; } @@ -1560,7 +1560,7 @@ void tms32082_mp_device::execute_reg_long_imm() { double s1 = u2d(m_fpair[src1 >> 1]); double s2 = u2d(m_fpair[rs >> 1]); - UINT64 res = d2u((double)(s1 * s2)); + UINT64 res = d2u(s1 * s2); m_fpair[rd >> 1] = res; break; } diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 23d087d0b4c..c665053af7a 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -924,8 +924,8 @@ void v810_device::opADDF(UINT32 op) float val2=u2f(GETREG(GET2)); SET_OV(0); val2+=val1; - SET_Z((val2==0.0)?1:0); - SET_S((val2<0.0)?1:0); + SET_Z((val2==0.0f)?1:0); + SET_S((val2<0.0f)?1:0); SETREG(GET2,f2u(val2)); } @@ -936,8 +936,8 @@ void v810_device::opSUBF(UINT32 op) SET_OV(0); SET_CY((val2<val1)?1:0); val2-=val1; - SET_Z((val2==0.0)?1:0); - SET_S((val2<0.0)?1:0); + SET_Z((val2==0.0f)?1:0); + SET_S((val2<0.0f)?1:0); SETREG(GET2,f2u(val2)); } @@ -948,8 +948,8 @@ void v810_device::opMULF(UINT32 op) float val2=u2f(GETREG(GET2)); SET_OV(0); val2*=val1; - SET_Z((val2==0.0)?1:0); - SET_S((val2<0.0)?1:0); + SET_Z((val2==0.0f)?1:0); + SET_S((val2<0.0f)?1:0); SETREG(GET2,f2u(val2)); } @@ -963,8 +963,8 @@ void v810_device::opDIVF(UINT32 op) val2/=val1; else printf("DIVF divide by zero?\n"); - SET_Z((val2==0.0)?1:0); - SET_S((val2<0.0)?1:0); + SET_Z((val2==0.0f)?1:0); + SET_S((val2<0.0f)?1:0); SETREG(GET2,f2u(val2)); } @@ -972,8 +972,8 @@ void v810_device::opTRNC(UINT32 op) { float val1=u2f(GETREG(GET1)); SET_OV(0); - SET_Z((val1==0.0)?1:0); - SET_S((val1<0.0)?1:0); + SET_Z((val1==0.0f)?1:0); + SET_S((val1<0.0f)?1:0); SETREG(GET2,(INT32)val1); } @@ -984,16 +984,16 @@ void v810_device::opCMPF(UINT32 op) SET_OV(0); SET_CY((val2<val1)?1:0); val2-=val1; - SET_Z((val2==0.0)?1:0); - SET_S((val2<0.0)?1:0); + SET_Z((val2==0.0f)?1:0); + SET_S((val2<0.0f)?1:0); } void v810_device::opCVTS(UINT32 op) { float val1=u2f(GETREG(GET1)); SET_OV(0); - SET_Z((val1==0.0)?1:0); - SET_S((val1<0.0)?1:0); + SET_Z((val1==0.0f)?1:0); + SET_S((val1<0.0f)?1:0); SETREG(GET2,(INT32)val1); } @@ -1002,8 +1002,8 @@ void v810_device::opCVTW(UINT32 op) //TODO: CY float val1=(INT32)GETREG(GET1); SET_OV(0); - SET_Z((val1==0.0)?1:0); - SET_S((val1<0.0)?1:0); + SET_Z((val1==0.0f)?1:0); + SET_S((val1<0.0f)?1:0); SETREG(GET2,f2u(val1)); } @@ -1013,8 +1013,8 @@ void v810_device::opMPYHW(UINT32 op) int val2=(GETREG(GET2) & 0xffff); SET_OV(0); val2*=val1; - SET_Z((val2==0.0)?1:0); - SET_S((val2<0.0)?1:0); + SET_Z((val2==0.0f)?1:0); + SET_S((val2<0.0f)?1:0); SETREG(GET2,val2); } @@ -1023,8 +1023,8 @@ void v810_device::opXB(UINT32 op) int val=GETREG(GET2); SET_OV(0); val = (val & 0xffff0000) | ((val & 0xff) << 8) | ((val & 0xff00) >> 8); - SET_Z((val==0.0)?1:0); - SET_S((val<0.0)?1:0); + SET_Z((val==0.0f)?1:0); + SET_S((val<0.0f)?1:0); SETREG(GET2,val); } @@ -1034,8 +1034,8 @@ void v810_device::opXH(UINT32 op) int val=GETREG(GET2); SET_OV(0); val = ((val & 0xffff0000)>>16) | ((val & 0xffff)<<16); - SET_Z((val==0.0)?1:0); - SET_S((val<0.0)?1:0); + SET_Z((val==0.0f)?1:0); + SET_S((val<0.0f)?1:0); SETREG(GET2,val); } diff --git a/src/emu/ioport.c b/src/emu/ioport.c index 30f85ccb4fd..e13d4e0d2e4 100644 --- a/src/emu/ioport.c +++ b/src/emu/ioport.c @@ -1995,7 +1995,7 @@ void ioport_field::frame_update(ioport_value &result, bool mouse_down) void ioport_field::crosshair_position(float &x, float &y, bool &gotx, bool &goty) { - float value = m_live->analog->crosshair_read(); + double value = m_live->analog->crosshair_read(); // apply the scale and offset if (m_crosshair_scale < 0) diff --git a/src/emu/luaengine.c b/src/emu/luaengine.c index 25d3b25d7e7..588c8334eff 100644 --- a/src/emu/luaengine.c +++ b/src/emu/luaengine.c @@ -642,10 +642,10 @@ int lua_engine::lua_screen::l_draw_box(lua_State *L) int sc_width = sc->visible_area().width(); int sc_height = sc->visible_area().height(); float x1, y1, x2, y2; - x1 = MIN(MAX(0, lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width); - y1 = MIN(MAX(0, lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height); - x2 = MIN(MAX(0, lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width); - y2 = MIN(MAX(0, lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height); + x1 = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width); + y1 = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height); + x2 = MIN(MAX(0, (float) lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width); + y2 = MIN(MAX(0, (float) lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height); UINT32 bgcolor = lua_tounsigned(L, 6); UINT32 fgcolor = lua_tounsigned(L, 7); @@ -680,10 +680,10 @@ int lua_engine::lua_screen::l_draw_line(lua_State *L) int sc_width = sc->visible_area().width(); int sc_height = sc->visible_area().height(); float x1, y1, x2, y2; - x1 = MIN(MAX(0, lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width); - y1 = MIN(MAX(0, lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height); - x2 = MIN(MAX(0, lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width); - y2 = MIN(MAX(0, lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height); + x1 = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width); + y1 = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height); + x2 = MIN(MAX(0, (float) lua_tonumber(L, 4)), sc_width-1) / static_cast<float>(sc_width); + y2 = MIN(MAX(0, (float) lua_tonumber(L, 5)), sc_height-1) / static_cast<float>(sc_height); UINT32 color = lua_tounsigned(L, 6); // draw the line @@ -712,8 +712,8 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L) // retrieve all parameters int sc_width = sc->visible_area().width(); int sc_height = sc->visible_area().height(); - float x = MIN(MAX(0, lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width); - float y = MIN(MAX(0, lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height); + float x = MIN(MAX(0, (float) lua_tonumber(L, 2)), sc_width-1) / static_cast<float>(sc_width); + float y = MIN(MAX(0, (float) lua_tonumber(L, 3)), sc_height-1) / static_cast<float>(sc_height); const char *msg = luaL_checkstring(L,4); rgb_t textcolor = UI_TEXT_COLOR; if (!lua_isnone(L, 5)) { diff --git a/src/emu/machine/upd1990a.c b/src/emu/machine/upd1990a.c index 9069deb96a2..f40bb30af48 100644 --- a/src/emu/machine/upd1990a.c +++ b/src/emu/machine/upd1990a.c @@ -309,7 +309,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w ) m_shift_reg[i] = m_time_counter[i]; // data out pulse: uPD4990A: 1Hz, uPD1990A: 512Hz in testmode, 0.5Hz in normal mode - float div; + double div; if (m_variant == TYPE_4990A) div = 32768.0; else if (m_testmode) @@ -331,7 +331,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w ) case MODE_TP_4096HZ: { // set timer pulse - const float div[4] = { 512.0, 128.0, 16.0, 8.0 }; + const double div[4] = { 512.0, 128.0, 16.0, 8.0 }; m_timer_tp->adjust(attotime::zero, 0, attotime::from_hz((clock() / div[m_c - MODE_TP_64HZ]) * 2.0)); break; @@ -344,7 +344,7 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w ) { // set timer pulse attotime one_second = attotime::from_hz(clock() / 32768.0); - const float mul[4] = { 1.0, 10.0, 30.0, 60.0 }; + const double mul[4] = { 1.0, 10.0, 30.0, 60.0 }; m_timer_tp->adjust(attotime::zero, 0, one_second * mul[m_c - MODE_TP_1S_INT] / 2.0); break; diff --git a/src/emu/render.c b/src/emu/render.c index 30a0b992215..57fcc418e97 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -1890,7 +1890,7 @@ bool render_target::map_point_internal(INT32 target_x, INT32 target_y, render_co if (container != NULL && container == &m_manager.ui_container()) { // this hit test went against the UI container - if (target_fx >= 0.0 && target_fx < 1.0 && target_fy >= 0.0 && target_fy < 1.0) + if (target_fx >= 0.0f && target_fx < 1.0f && target_fy >= 0.0f && target_fy < 1.0f) { // this point was successfully mapped mapped_x = (float)target_x / m_width; diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index a3b5f48e8b1..c72a291dbb5 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -327,7 +327,8 @@ void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bo // check for errors if (bounds.x0 > bounds.x1 || bounds.y0 > bounds.y1) - throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", bounds.x0, bounds.x1, bounds.y0, bounds.y1); + throw emu_fatalerror("Illegal bounds value in XML: (%f-%f)-(%f-%f)", + (double) bounds.x0, (double) bounds.x1, (double) bounds.y0, (double) bounds.y1); } @@ -351,9 +352,10 @@ void parse_color(running_machine &machine, xml_data_node *colornode, render_colo color.a = xml_get_attribute_float_with_subst(machine, *colornode, "alpha", 1.0); // check for errors - if (color.r < 0.0 || color.r > 1.0 || color.g < 0.0 || color.g > 1.0 || - color.b < 0.0 || color.b > 1.0 || color.a < 0.0 || color.a > 1.0) - throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", color.r, color.g, color.b, color.a); + if (color.r < 0.0f || color.r > 1.0f || color.g < 0.0f || color.g > 1.0f || + color.b < 0.0f || color.b > 1.0f || color.a < 0.0f || color.a > 1.0f) + throw emu_fatalerror("Illegal ARGB color value in XML: %f,%f,%f,%f", + (double) color.r, (double) color.g, (double) color.b, (double) color.a); } @@ -807,10 +809,10 @@ void layout_element::component::draw(running_machine &machine, bitmap_argb32 &de void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &bounds) { // compute premultiplied colors - UINT32 r = m_color.r * m_color.a * 255.0; - UINT32 g = m_color.g * m_color.a * 255.0; - UINT32 b = m_color.b * m_color.a * 255.0; - UINT32 inva = (1.0f - m_color.a) * 255.0; + UINT32 r = m_color.r * m_color.a * 255.0f; + UINT32 g = m_color.g * m_color.a * 255.0f; + UINT32 b = m_color.b * m_color.a * 255.0f; + UINT32 inva = (1.0f - m_color.a) * 255.0f; // iterate over X and Y for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++) @@ -845,10 +847,10 @@ void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle & void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &bounds) { // compute premultiplied colors - UINT32 r = m_color.r * m_color.a * 255.0; - UINT32 g = m_color.g * m_color.a * 255.0; - UINT32 b = m_color.b * m_color.a * 255.0; - UINT32 inva = (1.0f - m_color.a) * 255.0; + UINT32 r = m_color.r * m_color.a * 255.0f; + UINT32 g = m_color.g * m_color.a * 255.0f; + UINT32 b = m_color.b * m_color.a * 255.0f; + UINT32 inva = (1.0f - m_color.a) * 255.0f; // find the center float xcenter = float(bounds.xcenter()); @@ -861,7 +863,7 @@ void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle & for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++) { float ycoord = ycenter - ((float)y + 0.5f); - float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2); + float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2); // compute left/right coordinates INT32 left = (INT32)(xcenter - xval + 0.5f); @@ -897,10 +899,10 @@ void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle & void layout_element::component::draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds) { // compute premultiplied colors - UINT32 r = m_color.r * 255.0; - UINT32 g = m_color.g * 255.0; - UINT32 b = m_color.b * 255.0; - UINT32 a = m_color.a * 255.0; + UINT32 r = m_color.r * 255.0f; + UINT32 g = m_color.g * 255.0f; + UINT32 b = m_color.b * 255.0f; + UINT32 a = m_color.a * 255.0f; // get the width of the string render_font *font = machine.render().font_alloc("default"); @@ -1006,10 +1008,10 @@ void layout_element::component::draw_reel(running_machine &machine, bitmap_argb3 int use_state = (state + m_stateoffset) % max_state_used; // compute premultiplied colors - UINT32 r = m_color.r * 255.0; - UINT32 g = m_color.g * 255.0; - UINT32 b = m_color.b * 255.0; - UINT32 a = m_color.a * 255.0; + UINT32 r = m_color.r * 255.0f; + UINT32 g = m_color.g * 255.0f; + UINT32 b = m_color.b * 255.0f; + UINT32 a = m_color.a * 255.0f; // get the width of the string render_font *font = machine.render().font_alloc("default"); @@ -1159,10 +1161,10 @@ void layout_element::component::draw_beltreel(running_machine &machine, bitmap_a int use_state = (state + m_stateoffset) % max_state_used; // compute premultiplied colors - UINT32 r = m_color.r * 255.0; - UINT32 g = m_color.g * 255.0; - UINT32 b = m_color.b * 255.0; - UINT32 a = m_color.a * 255.0; + UINT32 r = m_color.r * 255.0f; + UINT32 g = m_color.g * 255.0f; + UINT32 b = m_color.b * 255.0f; + UINT32 a = m_color.a * 255.0f; // get the width of the string render_font *font = machine.render().font_alloc("default"); diff --git a/src/emu/sound.c b/src/emu/sound.c index b4179336582..ed5527edc39 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -225,7 +225,8 @@ int sound_stream::input_source_outputnum(int inputnum) const void sound_stream::set_input(int index, sound_stream *input_stream, int output_index, float gain) { - VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", this, m_device.tag(), index, input_stream, output_index, gain)); + VPRINTF(("stream_set_input(%p, '%s', %d, %p, %d, %f)\n", this, m_device.tag(), + index, input_stream, output_index, (double) gain)); // make sure it's a valid input if (index >= m_input.size()) @@ -983,9 +984,9 @@ void sound_manager::config_load(int config_type, xml_data_node *parentnode) mixer_input info; if (indexed_mixer_input(xml_get_attribute_int(channelnode, "index", -1), info)) { - float defvol = xml_get_attribute_float(channelnode, "defvol", 1.0); - float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0); - if (newvol != -1000.0) + float defvol = xml_get_attribute_float(channelnode, "defvol", 1.0f); + float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0f); + if (newvol != -1000.0f) info.stream->set_user_gain(info.inputnum, newvol / defvol); } } diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c index 25023db43cc..225d3e396e1 100644 --- a/src/emu/sound/aica.c +++ b/src/emu/sound/aica.c @@ -24,10 +24,10 @@ #define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v))) //Convert DB to multiply amplitude -#define DB(v) LFIX(pow(10.0,v/20.0)) +#define DB(v) LFIX(powf(10.0f,v/20.0f)) //Convert cents to step increment -#define CENTS(v) LFIX(pow(2.0,v/1200.0)) +#define CENTS(v) LFIX(powf(2.0f,v/1200.0f)) /* AICA features 64 programmable slots diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index 980cf034774..e0998a271d6 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -648,7 +648,7 @@ void discrete_device::display_profiling(void) discrete_step_interface *step; if ((*node)->interface(step)) if (step->run_time > tresh) - printf("%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), (float) step->run_time / (float) total * 100.0, ((float) step->run_time) / (float) m_total_samples); + printf("%3d: %20s %8.2f %10.2f\n", (*node)->index(), (*node)->module_name(), (double) step->run_time / (double) total * 100.0, ((double) step->run_time) / (double) m_total_samples); } /* Task information */ diff --git a/src/emu/sound/fm.c b/src/emu/sound/fm.c index 1e14bf132b1..f5ddf3cdf55 100644 --- a/src/emu/sound/fm.c +++ b/src/emu/sound/fm.c @@ -2548,7 +2548,7 @@ static void FM_ADPCMAWrite(YM2610 *F2610,int r,int v) if( (v>>c)&1 ) { /**** start adpcm ****/ - adpcm[c].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0); + adpcm[c].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0f); adpcm[c].now_addr = adpcm[c].start<<1; adpcm[c].now_step = 0; adpcm[c].adpcm_acc = 0; @@ -3043,9 +3043,9 @@ void ym2608_reset_chip(void *chip) for( i = 0; i < 6; i++ ) { if (i<=3) /* channels 0,1,2,3 */ - F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/3.0); + F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/3.0f); else /* channels 4 and 5 work with slower clock */ - F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/6.0); + F2608->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2608->OPN.ST.freqbase)/6.0f); F2608->adpcm[i].start = YM2608_ADPCM_ROM_addr[i*2]; F2608->adpcm[i].end = YM2608_ADPCM_ROM_addr[i*2+1]; @@ -3721,7 +3721,7 @@ void ym2610_reset_chip(void *chip) /**** ADPCM work initial ****/ for( i = 0; i < 6 ; i++ ) { - F2610->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0); + F2610->adpcm[i].step = (UINT32)((float)(1<<ADPCM_SHIFT)*((float)F2610->OPN.ST.freqbase)/3.0f); F2610->adpcm[i].now_addr = 0; F2610->adpcm[i].now_step = 0; F2610->adpcm[i].start = 0; diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index 3050d07cc17..37399e10c36 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -158,7 +158,7 @@ void multipcm_device::EG_Calc(SLOT *slot) #define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v))) //Convert DB to multiply amplitude -#define DB(v) LFIX(pow(10.0,v/20.0)) +#define DB(v) LFIX(powf(10.0f,v/20.0f)) //Convert cents to step increment #define CENTS(v) LFIX(powf(2.0f,v/1200.0f)) diff --git a/src/emu/sound/scsp.c b/src/emu/sound/scsp.c index bd9995ba559..eb9479e4782 100644 --- a/src/emu/sound/scsp.c +++ b/src/emu/sound/scsp.c @@ -590,7 +590,7 @@ void scsp_device::init() t=ARTimes[i]; //In ms if(t!=0.0) { - step=(1023*1000.0)/( 44100.0f*t); + step=(1023*1000.0)/( 44100.0*t); scale=(double) (1<<EG_SHIFT); m_ARTABLE[i]=(int) (step*scale); } @@ -1432,10 +1432,10 @@ READ16_MEMBER( scsp_device::midi_out_r ) #define LFIX(v) ((unsigned int) ((float) (1<<LFO_SHIFT)*(v))) //Convert DB to multiply amplitude -#define DB(v) LFIX(pow(10.0,v/20.0)) +#define DB(v) LFIX(powf(10.0f,v/20.0f)) //Convert cents to step increment -#define CENTS(v) LFIX(pow(2.0,v/1200.0)) +#define CENTS(v) LFIX(powf(2.0f,v/1200.0f)) static const float LFOFreq[32]= diff --git a/src/emu/sound/sidvoice.c b/src/emu/sound/sidvoice.c index 8f9f1c1f3ee..2dd42bcf3c4 100644 --- a/src/emu/sound/sidvoice.c +++ b/src/emu/sound/sidvoice.c @@ -344,7 +344,7 @@ INLINE void waveCalcFilter(sidOperator* pVoice) else if (pVoice->sid->filter.Type == 0x40) { float tmp, tmp2; - pVoice->filtLow += ( pVoice->filtRef * pVoice->sid->filter.Dy * 0.1 ); + pVoice->filtLow += ( pVoice->filtRef * pVoice->sid->filter.Dy * 0.1f ); tmp = (float)pVoice->filtIO - pVoice->filtLow; tmp -= pVoice->filtRef * pVoice->sid->filter.ResDy; pVoice->filtRef += ( tmp * (pVoice->sid->filter.Dy) ); diff --git a/src/emu/sound/spu.c b/src/emu/sound/spu.c index be836f543a4..433f7737ba6 100644 --- a/src/emu/sound/spu.c +++ b/src/emu/sound/spu.c @@ -2333,9 +2333,9 @@ void spu_device::set_xa_format(const float _freq, const int channels) // Adjust frequency to compensate for slightly slower/faster frame rate // float freq=44100.0; //(_freq*get_adjusted_frame_rate())/ps1hw.rcnt->get_vertical_refresh(); - xa_freq=(unsigned int)((_freq/44100.0)*4096.0f); + xa_freq=(unsigned int)((_freq/44100.0f)*4096.0f); xa_channels=channels; - xa_spf=(unsigned int)(_freq/60.0)*channels; + xa_spf=(unsigned int)(_freq/60.0f)*channels; } // diff --git a/src/emu/ui/inputmap.c b/src/emu/ui/inputmap.c index d41e9e9b08f..9aa63fdcec9 100644 --- a/src/emu/ui/inputmap.c +++ b/src/emu/ui/inputmap.c @@ -25,7 +25,7 @@ /* DIP switch rendering parameters */ #define DIP_SWITCH_HEIGHT 0.05f -#define DIP_SWITCH_SPACING 0.01 +#define DIP_SWITCH_SPACING 0.01f #define SINGLE_TOGGLE_SWITCH_FIELD_WIDTH 0.025f #define SINGLE_TOGGLE_SWITCH_WIDTH 0.020f /* make the switch 80% of the width space and 1/2 of the switch height */ diff --git a/src/emu/ui/menu.c b/src/emu/ui/menu.c index 9cb279ebd51..c53cfd5146d 100644 --- a/src/emu/ui/menu.c +++ b/src/emu/ui/menu.c @@ -695,7 +695,7 @@ void ui_menu::draw_text_box() JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); target_height += 2.0f * line_height; if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER) - target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; + target_height = floorf((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; // maximum against "return to prior menu" text prior_width = machine().ui().get_string_width(backtext) + 2.0f * gutter_width; diff --git a/src/emu/ui/ui.c b/src/emu/ui/ui.c index 2f8897309b3..b9b9da66643 100644 --- a/src/emu/ui/ui.c +++ b/src/emu/ui/ui.c @@ -2044,8 +2044,8 @@ static INT32 slider_overclock(running_machine &machine, void *arg, std::string * if (newval != SLIDER_NOCHANGE) cpu->set_clock_scale((float)newval * 0.001f); if (str != NULL) - strprintf(*str,"%3.0f%%", floor(cpu->clock_scale() * 100.0f + 0.5f)); - return floorf(cpu->clock_scale() * 1000.0f + 0.5f); + strprintf(*str,"%3.0f%%", floor(cpu->clock_scale() * 100.0 + 0.5)); + return floor(cpu->clock_scale() * 1000.0 + 0.5); } @@ -2069,7 +2069,7 @@ static INT32 slider_refresh(running_machine &machine, void *arg, std::string *st if (str != NULL) strprintf(*str,"%.3ffps", ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds)); refresh = ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds); - return floorf((refresh - defrefresh) * 1000.0f + 0.5f); + return floor((refresh - defrefresh) * 1000.0 + 0.5); } diff --git a/src/emu/validity.c b/src/emu/validity.c index 28ba842df85..2c5e08cb40b 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -482,7 +482,7 @@ void validity_checker::validate_inlines() if (resultu32 != expectedu32) osd_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", (UINT32)testu64a, testu32a, resultu32, expectedu32); - if (fabs(recip_approx(100.0) - 0.01) > 0.0001) + if (fabsf(recip_approx(100.0f) - 0.01f) > 0.0001f) osd_printf_error("Error testing recip_approx\n"); testi32a = (testi32a & 0x0000ffff) | 0x400000; diff --git a/src/emu/video.c b/src/emu/video.c index 55e596d36bc..2ce890d44e4 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -636,7 +636,7 @@ inline bool video_manager::effective_throttle() const inline int video_manager::original_speed_setting() const { - return machine().options().speed() * 1000.0 + 0.5; + return machine().options().speed() * 1000.0f + 0.5f; } @@ -901,7 +901,7 @@ void video_manager::update_frameskip() if (effective_throttle() && effective_autoframeskip() && m_frameskip_counter == 0) { // calibrate the "adjusted speed" based on the target - double adjusted_speed_percent = m_speed_percent / m_throttle_rate; + double adjusted_speed_percent = m_speed_percent / (double) m_throttle_rate; // if we're too fast, attempt to increase the frameskip double speed = m_speed * 0.001; @@ -953,7 +953,7 @@ void video_manager::update_refresh_speed() // only do this if the refreshspeed option is used if (machine().options().refresh_speed()) { - float minrefresh = machine().render().max_update_rate(); + double minrefresh = machine().render().max_update_rate(); if (minrefresh != 0) { // find the screen with the shortest frame period (max refresh rate) @@ -970,7 +970,7 @@ void video_manager::update_refresh_speed() // compute a target speed as an integral percentage // note that we lop 0.25Hz off of the minrefresh when doing the computation to allow for // the fact that most refresh rates are not accurate to 10 digits... - UINT32 target_speed = floor((minrefresh - 0.25f) * 1000.0 / ATTOSECONDS_TO_HZ(min_frame_period)); + UINT32 target_speed = floor((minrefresh - 0.25) * 1000.0 / ATTOSECONDS_TO_HZ(min_frame_period)); UINT32 original_speed = original_speed_setting(); target_speed = MIN(target_speed, original_speed); diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c index f9b5166fa77..d67a7df128a 100644 --- a/src/emu/video/pc_vga.c +++ b/src/emu/video/pc_vga.c @@ -2672,7 +2672,7 @@ void s3_vga_device::s3_define_video_mode() if((vga.miscellaneous_output & 0xc) == 0x0c) { // DCLK calculation - freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318f; // clock between XIN and XOUT + freq = ((double)(s3.clk_pll_m+2) / (double)((s3.clk_pll_n+2)*(pow(2.0,s3.clk_pll_r)))) * 14.318; // clock between XIN and XOUT xtal = freq * 1000000; } diff --git a/src/emu/video/polylgcy.c b/src/emu/video/polylgcy.c index 575226e26a3..720110e5ca3 100644 --- a/src/emu/video/polylgcy.c +++ b/src/emu/video/polylgcy.c @@ -607,7 +607,7 @@ UINT32 poly_render_triangle(legacy_poly_manager *poly, void *dest, const rectang float a22 = v1->x*v2->y - v2->x*v1->y; float det = a02 + a12 + a22; - if(fabsf(det) < 0.001) { + if(fabsf(det) < 0.001f) { for (int paramnum = 0; paramnum < paramcount; paramnum++) { poly_param *params = &polygon->param[paramnum]; diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c index b27c794723c..1942aaa392f 100644 --- a/src/emu/video/voodoo.c +++ b/src/emu/video/voodoo.c @@ -2918,7 +2918,7 @@ default_case: if (regnum < fvertexAx || regnum > fdWdY) logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, origdata); else - logerror("VOODOO.%d.REG:%s(%d) write = %f\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, u2f(origdata)); + logerror("VOODOO.%d.REG:%s(%d) write = %f\n", v->index, (regnum < 0x384/4) ? v->regnames[regnum] : "oob", chips, (double) u2f(origdata)); } return cycles; @@ -5436,12 +5436,12 @@ static INT32 setup_and_draw_triangle(voodoo_state *v) float divisor, tdiv; /* grab the X/Ys at least */ - v->fbi.ax = (INT16)(v->fbi.svert[0].x * 16.0); - v->fbi.ay = (INT16)(v->fbi.svert[0].y * 16.0); - v->fbi.bx = (INT16)(v->fbi.svert[1].x * 16.0); - v->fbi.by = (INT16)(v->fbi.svert[1].y * 16.0); - v->fbi.cx = (INT16)(v->fbi.svert[2].x * 16.0); - v->fbi.cy = (INT16)(v->fbi.svert[2].y * 16.0); + v->fbi.ax = (INT16)(v->fbi.svert[0].x * 16.0f); + v->fbi.ay = (INT16)(v->fbi.svert[0].y * 16.0f); + v->fbi.bx = (INT16)(v->fbi.svert[1].x * 16.0f); + v->fbi.by = (INT16)(v->fbi.svert[1].y * 16.0f); + v->fbi.cx = (INT16)(v->fbi.svert[2].x * 16.0f); + v->fbi.cy = (INT16)(v->fbi.svert[2].y * 16.0f); /* compute the divisor */ divisor = 1.0f / ((v->fbi.svert[0].x - v->fbi.svert[1].x) * (v->fbi.svert[0].y - v->fbi.svert[2].y) - @@ -5486,7 +5486,7 @@ static INT32 setup_and_draw_triangle(voodoo_state *v) /* set up alpha */ if (v->reg[sSetupMode].u & (1 << 1)) { - v->fbi.starta = (INT32)(v->fbi.svert[0].a * 4096.0); + v->fbi.starta = (INT32)(v->fbi.svert[0].a * 4096.0f); v->fbi.dadx = (INT32)(((v->fbi.svert[0].a - v->fbi.svert[1].a) * dx1 - (v->fbi.svert[0].a - v->fbi.svert[2].a) * dx2) * tdiv); v->fbi.dady = (INT32)(((v->fbi.svert[0].a - v->fbi.svert[2].a) * dy1 - (v->fbi.svert[0].a - v->fbi.svert[1].a) * dy2) * tdiv); } @@ -5494,7 +5494,7 @@ static INT32 setup_and_draw_triangle(voodoo_state *v) /* set up Z */ if (v->reg[sSetupMode].u & (1 << 2)) { - v->fbi.startz = (INT32)(v->fbi.svert[0].z * 4096.0); + v->fbi.startz = (INT32)(v->fbi.svert[0].z * 4096.0f); v->fbi.dzdx = (INT32)(((v->fbi.svert[0].z - v->fbi.svert[1].z) * dx1 - (v->fbi.svert[0].z - v->fbi.svert[2].z) * dx2) * tdiv); v->fbi.dzdy = (INT32)(((v->fbi.svert[0].z - v->fbi.svert[2].z) * dy1 - (v->fbi.svert[0].z - v->fbi.svert[1].z) * dy2) * tdiv); } diff --git a/src/lib/formats/tzx_cas.c b/src/lib/formats/tzx_cas.c index 811156b3062..6037c200122 100644 --- a/src/lib/formats/tzx_cas.c +++ b/src/lib/formats/tzx_cas.c @@ -213,7 +213,7 @@ INLINE int millisec_to_samplecount( int millisec ) INLINE int tcycles_to_samplecount( int tcycles ) { - return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * t_scale); + return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * (double) t_scale); } static void tzx_output_wave( INT16 **buffer, int length ) diff --git a/src/lib/util/options.c b/src/lib/util/options.c index d229624017a..62c3cc0379a 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -642,7 +642,7 @@ bool core_options::set_value(const char *name, int value, int priority, std::str bool core_options::set_value(const char *name, float value, int priority, std::string &error_string) { std::string tempstr; - strprintf(tempstr, "%f", value); + strprintf(tempstr, "%f", (double) value); return set_value(name, tempstr.c_str(), priority, error_string); } @@ -780,7 +780,7 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch strcatprintf(error_string, "Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } - if (curentry.has_range() && (fval < atof(curentry.minimum()) || fval > atof(curentry.maximum()))) + if (curentry.has_range() && ((double) fval < atof(curentry.minimum()) || (double) fval > atof(curentry.maximum()))) { strcatprintf(error_string, "Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); return false; diff --git a/src/lib/util/xmlfile.c b/src/lib/util/xmlfile.c index 8635cfc427f..7956654a984 100644 --- a/src/lib/util/xmlfile.c +++ b/src/lib/util/xmlfile.c @@ -511,7 +511,7 @@ xml_attribute_node *xml_set_attribute_int(xml_data_node *node, const char *name, xml_attribute_node *xml_set_attribute_float(xml_data_node *node, const char *name, float value) { char buffer[100]; - sprintf(buffer, "%f", value); + sprintf(buffer, "%f", (double) value); return xml_set_attribute(node, name, buffer); } diff --git a/src/mess/tools/imgtool/imgtool.c b/src/mess/tools/imgtool/imgtool.c index f5ca6467921..df44a9bbff2 100644 --- a/src/mess/tools/imgtool/imgtool.c +++ b/src/mess/tools/imgtool/imgtool.c @@ -343,9 +343,9 @@ static imgtoolerr_t evaluate_module(const char *fname, goto done; if (ent.corrupt) - current_result = (current_result * 99 + 1.00) / 100; + current_result = (current_result * 99 + 1.00f) / 100; else - current_result = (current_result + 1.00) / 2; + current_result = (current_result + 1.00f) / 2; } while(!ent.eof); @@ -429,7 +429,7 @@ imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules, goto done; insert_module = module; - for (i = 0; (val > 0.0) && (i < count); i++) + for (i = 0; (val > 0.0f) && (i < count); i++) { if (val > values[i]) { |