Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rtext] incorrect handling of decimal point in TextToFloat #4272

Closed
4 tasks done
ListeriaM opened this issue Aug 21, 2024 · 0 comments · Fixed by #4273
Closed
4 tasks done

[rtext] incorrect handling of decimal point in TextToFloat #4272

ListeriaM opened this issue Aug 21, 2024 · 0 comments · Fixed by #4273

Comments

@ListeriaM
Copy link
Contributor

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

The function can't return a negative value if there is a decimal point.

Code Example

#include <raylib.h>

static void parse(const char *text)
{
	TraceLog(LOG_INFO, "TextToFloat(\"%s\") = %g", text, TextToFloat(text));
}

int main(void)
{
	parse("-1");
	parse("-1.");
	parse("-1.5");
}

output:

INFO: TextToFloat("-1") = -1
INFO: TextToFloat("-1.") = 1
INFO: TextToFloat("-1.5") = 1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant