• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

The Return of the Pentium Bug!

my seadogs.c:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void Main()

{

    int i;

    for(i = 0; i <= 20; i++)

    {

 trace((makefloat(i)*0.1) + ", mi " + makeint(makefloat(i)*0.1));

    }

    ExitProgram();

}<!--c2--></div><!--ec2-->
My compile.log:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->0., mi 0

0.1000000015, mi 0

0.200000003, mi 0

0.3000000119, mi 0

0.400000006, mi 0

0.5, mi 0

0.6000000238, mi 0

0.6999999881, mi 0

0.8000000119, mi 0

0.9000000358, mi 0

1., mi 1

1.100000024, mi 1

1.200000048, mi 1

1.300000072, mi 1

1.399999976, mi 1

1.5, mi 1

1.600000024, mi 1

1.700000048, mi 1

1.800000072, mi 1

1.899999976, mi 1

2., mi 2<!--c2--></div><!--ec2-->

That's...distressing. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
Indeed... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> I have no idea what that means... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />

Elaborate? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/bookish.gif" style="vertical-align:middle" emoid=":mm" border="0" alt="bookish.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
Sorry. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" />
What I'm doing is multiplying 0 through 20 with 0.1 each time, and tracing() the result.

I didn't think there was anything wrong--I was just doing this to see how makeint() reacts (I thought it rounded, turns out it rounds down).

So I was floored by the fact that the multiplaction was...wrong.
Not only wrong, but _differently_ wrong; there's a difference variance each time!

{By Pentium Bug, I mean the famous problem of early Pentium chips that gave wrong results on certain floating point operations}
 
Uh, in terms of the good news of this thread.
1. Now we know.

But 2, if I haven't mentioned this before...it's possible to make any seadogs.c file one likes, and add a void main() to it and an ExitProgram() at the end, and it works.
You can do basic math, time certain results, all without having to load up the entire game. No easy way to do input though...
 
Um, late but important thought.
Can anyone else confirm these results? Maybe it's my system (I hope).

If you'd like to try, rename your seadogs.c something else, make a new seadogs.c file and paste in my code above.
Make sure error logging is on.
Run engine.exe
Post the resulting compile.log
 
It's probably neither a bug in POTC nor in your machine, it's just that you can't trust `floating-point` numbers.
This thing about making your own main() is cool..
 
Back
Top