Page 1 of 1

[4.10]Maps store floats instead of doubles

Posted: Sun Dec 04, 2022 1:52 pm
by Major Cooke

Code: Select all

2>C:\Games\doom 2\GZSource\src\common\scripting\core\maps.cpp(165,23): warning C4244: 'argument': conversion from 'double' to 'VT', possible loss of data
2>        with
2>        [
2>            VT=float
2>        ]
2>C:\Games\doom 2\GZSource\src\common\scripting\core\maps.cpp(470): message : see reference to function template instantiation 'void MapInsert<FMap_I32_F32>(M *,unsigned int,double)' being compiled
2>        with
2>        [
2>            M=FMap_I32_F32
2>        ]
2>C:\Games\doom 2\GZSource\src\common\scripting\core\maps.cpp(249,11): warning C4244: '=': conversion from 'double' to 'VT', possible loss of data
2>        with
2>        [
2>            VT=float
2>        ]
2>C:\Games\doom 2\GZSource\src\common\scripting\core\maps.cpp(470): message : see reference to function template instantiation 'void MapIteratorSetValue<FMapIterator_I32_F32>(I *,double)' being compiled
2>        with
2>        [
2>            I=FMapIterator_I32_F32
2>        ]
I'm concerned that if it's used to store doubles, the result will not be precise if that's what's needed.

Re: [4.10]Maps store floats instead of doubles

Posted: Sun Dec 04, 2022 1:55 pm
by Graf Zahl
There's also a map type using doubles.

Re: [4.10]Maps store floats instead of doubles

Posted: Sun Dec 04, 2022 1:57 pm
by Jay0
That's not the case, there's a Map<X,float> for type 32-bit float types, and Map<X, double> for 64-bit float types (you can see that this is for the 32-bit type because the type is XXXX_F32 and not XXXX_F64)

Re: [4.10]Maps store floats instead of doubles

Posted: Sun Dec 04, 2022 1:58 pm
by Graf Zahl
Yes, I noticed while checking this out. Seems someone did not look deeply enough. Thank god it's a false alert.

Re: [4.10]Maps store floats instead of doubles

Posted: Sun Dec 04, 2022 2:00 pm
by Graf Zahl
Still needs the warnings fixed, though, but that's of lesser concern.

Re: [4.10]Maps store floats instead of doubles

Posted: Sun Dec 04, 2022 2:00 pm
by Major Cooke
Ah okay, glad to hear, was worried about that. I don't know how to read that code very well.