Double to Float

Started by
9 comments, last by Paul C Skertich 11 years, 6 months ago

@OP, simply casting your doubles to floats in the standard manner shown by SIC Games should be all you need. There's no trick to it. This will generate CPU assembly to read your 64-bit double from RAM into an FPU register (expanding the value to register precision, e.g. 80-bit), then write the contents of that register to a 32-bit float RAM address (rounding the value to 32-bit precision)
[quote name='JTippetts' timestamp='1349930650' post='4988957']I believe it was DirectX changing the FPU mode to float, whereas Lua wanted doubles. Things could be different now, though.
Yeah, when creating a D3D9 device, it sets some flags in the CPU to tell it to round all it's results to 32-bit precision. You've got to set the D3DCREATE_FPU_PRESERVE flag when creating your D3D9 device to avoid this.
[/quote]

Thanks bro for agreeing. I also like to add that when I tried to convert my mesh file from float to double - it didn't draw correctly until I switched it back to float. Though a XMVECTOR willt ake a double just it's less nessary. Hope this forum has helped out. It doesn't hurt to try and see for yourself though.
Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

This topic is closed to new replies.

Advertisement