Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to check overflow of float number

Status
Not open for further replies.

userx51

Junior Member level 2
Junior Member level 2
Joined
Apr 21, 2013
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,432
in C code, Microcontroller, how to find out if a x overflown?.
float x,y;
x=(y)*someval+z;
:-?
 

You can not find a variable was over flown but you can avoid it, if that was your series problem then do like this

Code C - [expand]

1
2
3
4
5
6
double temp;

if(temp = ((y)*someval+z) > MAX_FLOAT_VALUE)
of = 1;
else
x=(y)*someval+z;



better if you have doubt that its going to ovrflow then you shd use a double type....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top