sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

format functions

Open 0x00000ED opened this issue 1 year ago • 1 comments

Description

Why all functions that have a format argument dont indicate that the number is infinite?

Problematic Code (or Steps to Reproduce)

public void OnPluginStart()
{
  float nan = 0.0/0.0;
  float inf = 1.0/0.0;

  PrintToServer("PrintToServer %f %f %f", nan, inf, -inf);

  char buff[128];
  Format(buff, sizeof(buff), "Format %f %f %f", nan, inf, -inf);
  PrintToServer("%s", buff);

  char fts1[10];
  FloatToString(nan, fts1, sizeof(fts1));
  char fts2[10];
  FloatToString(inf, fts2, sizeof(fts2));
  char fts3[10];
  FloatToString(-inf, fts3, sizeof(fts3));

  PrintToServer("FloatToString %s %s %s", fts1, fts2, fts3);
}

Logs

// PrintToServer NaN 0.000000 -0.000000 // Format NaN 0.000000 -0.000000 // FloatToString -nan(ind) inf -inf

0x00000ED avatar Feb 02 '24 13:02 0x00000ED

I checked the source code of SourceMod:

F1F88 avatar May 30 '25 04:05 F1F88