Casting float-point to int produces truncation warning

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

Casting float-point to int produces truncation warning

Postby Blue Shadow » Thu Mar 04, 2021 6:02 pm

Tested with: GZDoom 4.5.0
Test material: https://www.dropbox.com/s/quk978uq8s8o8 ... n.pk3?dl=1



The following produces a floating-point truncation warning on start-up even though the result is cast to an integer:

Code: Select allExpand view
int var = int(256 * 0.7);

The demo file has this in it:

Code: Select allExpand view
class Test
{
    int Something ()
    {
        return int(256 * 0.7);
    }
}

Run it, and you should get the warning.
User avatar
Blue Shadow
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests