- Notifications
You must be signed in to change notification settings - Fork13.3k
detect division by zero in map() to prevent exceptions#2397
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Will return -1 like AVR would
codecov-io commentedAug 15, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Current coverage is 27.80% (diff: 100%)@@ master #2397 diff @@========================================== Files 20 20 Lines 3625 3625 Methods 335 335 Messages 0 0 Branches 656 656 ========================================== Hits 1008 1008 Misses 2441 2441 Partials 176 176
|
Seeesp8266/Arduino#2397 for details.
Seeesp8266/Arduino#2397 for details.
| if(divisor ==0){ | ||
| return -1;//AVR returns -1, SAM returns 0 | ||
| } | ||
| return (x - in_min) * (out_max - out_min) / divisor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
should be
divisor = in_max - in_min;return .../divisor + out_min;FernandoGarcia commentedJun 3, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi@me-no-dev! The EDIT: I'll place all information here because I'm not sure about the right version number. I'm using PIO. Best regards. |

Will return -1 like AVR would
connected to#2219