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

Wiring map function with wrong types #34

Closed
dbarragan opened this issue Apr 20, 2014 · 0 comments
Closed

Wiring map function with wrong types #34

dbarragan opened this issue Apr 20, 2014 · 0 comments

Comments

@dbarragan
Copy link
Contributor

when the code was re-roganized an error was introduced:

int32_t map(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

making the function to stop working with floats, it should be like this:

float map(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

long doesn't work as well.

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

No branches or pull requests

1 participant