Posted By: EvilSOB
Possible bug in Lite-C 7.80 - duplicating 'double's. - 08/17/09 07:36
Try this code...
In stage1, array is created, but not initialised cause everything will get filled manually.
In stage 2, values [0] and [1] get set, then 0,1,2,3 are all displayed. Cool.
In stage 3, values [2] and [3] get set, then 0,1,2,3 are all displayed again. WTF??.
look at the values of [0] and [1]... They now equal the values of [2] and [3]... WHY?
Am I doing something dumb?
Its not just the diag_var because if I subtract [2] and [3] from [0] and [1] I get EXACTLY zero on both subtractions.
Am I pushing the limits of the 'double' type too far? Im wondering cause the diag_var values are a little different
to what I set them to. But I put that down to double->var conversion (which is not important at this time).
I dont have a sample, but the EXACT same thing happens if I remove the array and use individually declared doubles.
Any ideas please? (and sorry if this is no bug)
PS: this code ATM lives alone inside the main function with nothing else running, so theres NO chance of anything else interfering.
Running on 7.80 commercial
Code:
function whatever() { double values[6]; values[0] = (double)2.862738448796; values[1] = (double)-8.642801642417908; diag_var("p1 = %.9f x ", (double)values[0]); diag_var("%.9f\n", (double)values[1]); diag_var("p2 = %.9f x ", (double)values[2]); diag_var("%.9f\n", (double)values[3]); values[2] = (double)2.86270802130925; values[3] = (double)-8.642629981040955; diag_var("p1 = %.9f x ", (double)values[0]); diag_var("%.9f\n", (double)values[1]); diag_var("p2 = %.9f x ", (double)values[2]); diag_var("%.9f\n", (double)values[3]); }
In stage1, array is created, but not initialised cause everything will get filled manually.
In stage 2, values [0] and [1] get set, then 0,1,2,3 are all displayed. Cool.
In stage 3, values [2] and [3] get set, then 0,1,2,3 are all displayed again. WTF??.
look at the values of [0] and [1]... They now equal the values of [2] and [3]... WHY?
Am I doing something dumb?
Its not just the diag_var because if I subtract [2] and [3] from [0] and [1] I get EXACTLY zero on both subtractions.
Am I pushing the limits of the 'double' type too far? Im wondering cause the diag_var values are a little different
to what I set them to. But I put that down to double->var conversion (which is not important at this time).
I dont have a sample, but the EXACT same thing happens if I remove the array and use individually declared doubles.
Any ideas please? (and sorry if this is no bug)
PS: this code ATM lives alone inside the main function with nothing else running, so theres NO chance of anything else interfering.
Running on 7.80 commercial