mirror of
https://github.com/g-truc/glm.git
synced 2024-11-30 03:44:38 +00:00
Fix floorMultiple/ceilMultiple for float
This commit is contained in:
parent
8f39bb8730
commit
de9e62f0a4
@ -104,10 +104,7 @@ namespace detail
|
|||||||
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
|
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
|
||||||
{
|
{
|
||||||
if(Source > genType(0))
|
if(Source > genType(0))
|
||||||
{
|
return Source + (Multiple - std::fmod(Source, Multiple));
|
||||||
genType Tmp = Source - genType(1);
|
|
||||||
return Tmp + (Multiple - std::fmod(Tmp, Multiple));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return Source + std::fmod(-Source, Multiple);
|
return Source + std::fmod(-Source, Multiple);
|
||||||
}
|
}
|
||||||
@ -152,10 +149,7 @@ namespace detail
|
|||||||
if(Source >= genType(0))
|
if(Source >= genType(0))
|
||||||
return Source - std::fmod(Source, Multiple);
|
return Source - std::fmod(Source, Multiple);
|
||||||
else
|
else
|
||||||
{
|
return Source - std::fmod(Source, Multiple) - Multiple;
|
||||||
genType Tmp = Source + genType(1);
|
|
||||||
return Tmp - std::fmod(Tmp, Multiple) - Multiple;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user