Re: ver 4.0 found the BUG in WIN98 code

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...

Bloody hell Bernie! Are trying to make helping you difficult!?

Let's see if I can get a straight and complete answer this time...

You are getting -2147483648 when you use "sprintf".

You are also getting -2147483648 when you use "printf".

In other words, the program below ...

puts(1, sprintf("%d", 3217040639)) 
puts(1, " : from sprintf\n") 
printf(1, "%d : from printf\n", 3217040639) 

Shows the following on your screen...

-2147483648 : from sprintf 
-2147483648 : from printf 

Can you run the following two programs for me ...

-- Program 1 
atom a 
a = 3217040635 
for i = 1 to 10 do 
   puts(1, sprintf("%d: %d", {i, a})) 
   puts(1, "\n") 
   a += 1 
end for 
-- Program 2 
atom a 
a = -2147483645 
for i = 1 to 10 do 
   puts(1, sprintf("%d: %d", {i, a})) 
   puts(1, "\n") 
   a += 1 
end for 

And show us the results you are getting.

By the way, 0x80000000 when stored in a C long integer represents a sequence that has not been allocated any memory in Euphoria. It does NOT represent the lowest Euphoria integer value.

The value 0x800000000 when stored in Euphoria is actually stored as a C double and not a C int.

 
You are getting -2147483648 when you use "sprintf". 
YES. 
 
You are also getting -2147483648 when you use "printf". 
YES. 
 
-- ============================================================================= 
This is exact screen printed out using EXW on WIN98 
 
 
Program 1 output 
1: -2147483648 
2: -2147483648 
3: -2147483648 
4: -2147483648 
5: -2147483648 
6: -2147483648 
7: -2147483648 
8: -2147483648 
9: -2147483648 
10: -2147483648 
 
Program 2 output 
1: -2147483645 
2: -2147483644 
3: -2147483643 
4: -2147483642 
5: -2147483641 
6: -2147483640 
7: -2147483639 
8: -2147483638 
9: -2147483637 
10: -2147483636 
 
This is exact screen printed out using EXWC on WIN98 
 
Program 1 output 
1: -2147483648 
2: -2147483648 
3: -2147483648 
4: -2147483648 
5: -2147483648 
6: -2147483648 
7: -2147483648 
8: -2147483648 
9: -2147483648 
10: -2147483648 
 
Program 2 output 
1: -2147483645 
2: -2147483644 
3: -2147483643 
4: -2147483642 
5: -2147483641 
6: -2147483640 
7: -2147483639 
8: -2147483638 
9: -2147483637 
10: -2147483636 
 
This is exact screen printed out using EX on WIN98 
 
Program 1 output 
1: -2147483648 
2: -2147483648 
3: -2147483648 
4: -2147483648 
5: -2147483648 
6: -2147483648 
7: -2147483648 
8: -2147483648 
9: -2147483648 
10: -2147483648 
 
Program 2 output 
1: -2147483645 
2: -2147483644 
3: -2147483643 
4: -2147483642 
5: -2147483641 
6: -2147483640 
7: -2147483639 
8: -2147483638 
9: -2147483637 
10: -2147483636 
 
-- ============================================================================= 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu