Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ void W3DRightHUDDraw( GameWindow *window, WinInstanceData *instData )

Real logN(Real value, Real logBase)
{
return (Real)log10(value)/ log10(logBase);
Real logBaseValue = (Real)log10(logBase);
// Prevent division by zero when logBase is 1 (log10(1) = 0)
if (logBaseValue == 0.0f)
{
return 0.0f;
}
return (Real)log10(value) / logBaseValue;
}

//-------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ void W3DRightHUDDraw( GameWindow *window, WinInstanceData *instData )

Real logN(Real value, Real logBase)
{
return (Real)log10(value)/ log10(logBase);
Real logBaseValue = (Real)log10(logBase);
// Prevent division by zero when logBase is 1 (log10(1) = 0)
if (logBaseValue == 0.0f)
{
return 0.0f;
}
return (Real)log10(value) / logBaseValue;
}

//-------------------------------------------------------------------------------------------------
Expand Down
Loading