**** Build of configuration Release for project bugTest ****
mingw32-make -k all
Building file: ../main.cpp
Invoking: GNU C++ Compiler
m68k-elf-g++ -m5206e -O2 -gdwarf-2 -fno-rtti -fno-exceptions -I"C:\Nburn\include_nn" -I"C:\Nburn\MOD5213\include" -I"C:\Nburn\gcc-m68k\include\c++\3.4.2" -I"C ...
Search found 18 matches
- Fri Sep 07, 2012 3:37 pm
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
- Thu Sep 06, 2012 1:54 pm
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
Hello Tod,
Hope you are not mad at me. I've been tied up by another project lately, sorry for the late reply.
I have reproduced the error based on your code snippet.
void TestAgain()
{
#define MAXADCCNTS 4095.0
float a = -1.0;
float b = -1.0;
char range = 0;
a = atof("-1.0");
b = atof("-1 ...
Hope you are not mad at me. I've been tied up by another project lately, sorry for the late reply.
I have reproduced the error based on your code snippet.
void TestAgain()
{
#define MAXADCCNTS 4095.0
float a = -1.0;
float b = -1.0;
char range = 0;
a = atof("-1.0");
b = atof("-1 ...
- Thu Aug 23, 2012 7:34 am
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
Hello, Tod.
Thank you for your info.
Currently I cast the denomenator to float, and that fixes the error.
My guess is that the calculation of (float)0.0/( double ) expression is the mistaken, since (float)0.0/( float )expression is correct.
I can not use your code directely without lots of mods ...
Thank you for your info.
Currently I cast the denomenator to float, and that fixes the error.
My guess is that the calculation of (float)0.0/( double ) expression is the mistaken, since (float)0.0/( float )expression is correct.
I can not use your code directely without lots of mods ...
- Tue Aug 21, 2012 3:13 pm
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
Just want to answer rnixon's question, sorry for the confusion.
What I mean is that the following statements are the same, and will give me wrong results:
x = (a - b) / (double)(MAXADCCNTS - ((range == 1) ? 819.0 : 0.0));
x = (a - b) / (MAXADCCNTS - ((range == 1) ? 819.0 : 0.0));
and I said ...
What I mean is that the following statements are the same, and will give me wrong results:
x = (a - b) / (double)(MAXADCCNTS - ((range == 1) ? 819.0 : 0.0));
x = (a - b) / (MAXADCCNTS - ((range == 1) ? 819.0 : 0.0));
and I said ...
- Fri Aug 17, 2012 8:08 am
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
Thanks.
Mine is rel20_rc_4.
Mine is rel20_rc_4.
- Thu Aug 16, 2012 1:50 pm
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
Thanks for all the replies.
I also tried casting to double as follows. This code gives the same error as without casting.
I guess it might be the defects in the compiler.
I understand that using "const float MAXADCCNTS = 4095.0;" is better practice.
But i don't think it will solve my problem ...
I also tried casting to double as follows. This code gives the same error as without casting.
I guess it might be the defects in the compiler.
I understand that using "const float MAXADCCNTS = 4095.0;" is better practice.
But i don't think it will solve my problem ...
- Thu Aug 16, 2012 10:27 am
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
Casting does correct it, but don't know why? BTW, a=-1.0, b=-1.0;
x= -166194084 without casting.
x = (a - b) / (float)(MAXADCCNTS - ((range == 1) ? 819.0 : 0.0));
x= -166194084 without casting.
x = (a - b) / (float)(MAXADCCNTS - ((range == 1) ? 819.0 : 0.0));
- Thu Aug 16, 2012 10:13 am
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
Re: MOD5213, atof convert"-0.0" to -2.0
#define MAXADCCNTS 4095.0
- Thu Aug 16, 2012 6:54 am
- Forum: NetBurner Software
- Topic: MOD5213, atof convert"-0.0" to -2.0
- Replies: 17
- Views: 13614
MOD5213, atof convert"-0.0" to -2.0
Hello every friends here,
It's been a long time I have not posted questions. However lately I found some bugs in the firmware I developed for the MOD5213 module. Apparently the atof() function convert "-0.0" to -2.0 instead of 0.0.
Also the following code gave me a huge negative number instead of ...
It's been a long time I have not posted questions. However lately I found some bugs in the firmware I developed for the MOD5213 module. Apparently the atof() function convert "-0.0" to -2.0 instead of 0.0.
Also the following code gave me a huge negative number instead of ...
- Mon Nov 02, 2009 11:18 am
- Forum: NetBurner Software
- Topic: Mod5213, Nburn version
- Replies: 10
- Views: 9977
Re: Mod5213, Nburn version
Thanks for your replies.
But what about dynamic variables? I do have dynamic variables used in my code.
Since the compiler does not know how much dynamic memory needed at runtime, the program still can crash even though the compiling is successful. right?
And what about the stacks?
BTW, since my ...
But what about dynamic variables? I do have dynamic variables used in my code.
Since the compiler does not know how much dynamic memory needed at runtime, the program still can crash even though the compiling is successful. right?
And what about the stacks?
BTW, since my ...