<div dir="ltr"><div><div>I think that as long as we aren't using functions like exp, sin, log, etc, it can be fixed. The IEEE 754 floating point standard is actually very strict about results being the same everywhere, and compilers not being allowed to change the results when performing optimisations. I think those functions are meant to return exactly the same result on all CPUs and compilers (at least, basic operations like multiplication definitely must); my ARM CPU is just not conformant.</div><div><br></div>I just need to find out the equivalent code for other OSes.<br><br></div>Anyway, if we couldn't make the fpu consistent, the best solution would be to change exptolevel to not use floating point math.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 November 2017 at 05:26, James Paige <span dir="ltr"><<a href="mailto:Bob@hamsterrepublic.com" target="_blank">Bob@hamsterrepublic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>If the problem isn't realistic to fix, then we might just have to make those particular tests more fuzzy.<br><br><span class="m_9176793573325680377gmail-im">abs(experience to level(2, bram slot) -- 69) < 2<br><br></span></div><span class="m_9176793573325680377gmail-im"></span>It ain't ideal but I could live with it.<br><div><div><div><br></div><div><br></div></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 7, 2017 at 8:23 AM, Ralph Versteegen <span dir="ltr"><<a href="mailto:teeemcee@gmail.com" target="_blank">teeemcee@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On 8 November 2017 at 05:18, Ralph Versteegen <span dir="ltr"><<a href="mailto:teeemcee@gmail.com" target="_blank">teeemcee@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>We have a bit of a problem: the xp formula produces different results in gengcc=1 builds!<br><br>! TRACE: ASSERT FAILURE:<br>! TRACE: autotest.hss:1127: experience to level(2, bram slot) == 69 [actual values were 70 == 69]<br><br></div>This would be because floating point calculations aren't totally reproduceable between different CPU architectures, compilers, and build options. The biggest problem is that the x87 FPU defaults to using 80 bit registers, so it makes a difference whether a compiler puts an intermediate result in a register or writes it out.</div><div>In this case, an intermediate result is 34.5, and it gets rounded differently.</div><div><br></div><div>By coincidence, I read through the long discussion at <a href="http://yosefk.com/blog/consistency-how-to-defeat-the-purpose-of-ieee-floating-point.html" target="_blank">http://yosefk.com/blog/consist<wbr>ency-how-to-defeat-the-purpose<wbr>-of-ieee-floating-point.html</a><br></div>about this just a week or two ago.<br><br></div>I've tried and confirmed that running the following linux-specific code to use 64-bit instead of 80-bit x87 registers fixes the assert failure:<br></div></div></blockquote><div><br></div></span><div>Oh, to be clear, it doesn't fix the failure, it just makes gengcc=0 and gengcc=1 consistent, by making them both return 70.</div><div>Of course, we do use floating point in a number of places, so I wonder how many of those could lead to a visible change.<br></div><div><div class="m_9176793573325680377h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>#include <fpu_control.h><br>fpu_control_t cw;<br>_FPU_GETCW(cw);<br>cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;<br>_FPU_SETCW(cw);</div><div><br></div><div>I read that this might have negative effects on the 
accuracy of math functions like pow() implemented with library 
routines, but it'll be pretty tiny.<br></div><div><br></div><div>I was planning on adding this anyway, to make scripts (once we add floating point to HS) more portable between CPUs and builds.</div><div>But you're never going to avoid 100% of differences. For example the ARM fpu in my phone gives larger errors on some math functions like exp, which actually causes several tests in freebasic's test suite to fail. <br></div><br></div><div class="m_9176793573325680377m_-1426486799890616929HOEnZb"><div class="m_9176793573325680377m_-1426486799890616929h5"><div class="gmail_extra"><br><div class="gmail_quote">On 1 November 2017 at 09:55,  <span dir="ltr"><<a href="mailto:subversion@hamsterrepublic.com" target="_blank">subversion@hamsterrepublic.co<wbr>m</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">james<br>
2017-10-31 13:55:49 -0700 (Tue, 31 Oct 2017)<br>
208<br>
The "experience to level" command now has a new optional hero slot argument for checking the experience curve of a specific hero<br>
Also added a test-case to autotest.rpg verifying a customized experience curve<br>
---<br>
U   wip/docs/plotdict.xml<br>
U   wip/docs/plotdictionary.html<br>
U   wip/plotscr.hsd<br>
U   wip/scriptcommands.bas<br>
U   wip/testgame/autotest.hss<br>
U   wip/testgame/autotest.rpg<br>
______________________________<wbr>_________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org" target="_blank">ohrrpgce@lists.motherhamster.o<wbr>rg</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" rel="noreferrer" target="_blank">http://lists.motherhamster.org<wbr>/listinfo.cgi/ohrrpgce-motherh<wbr>amster.org</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
<br>______________________________<wbr>_________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org" target="_blank">ohrrpgce@lists.motherhamster.o<wbr>rg</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" rel="noreferrer" target="_blank">http://lists.motherhamster.org<wbr>/listinfo.cgi/ohrrpgce-motherh<wbr>amster.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Ohrrpgce mailing list<br>
<a href="mailto:ohrrpgce@lists.motherhamster.org">ohrrpgce@lists.motherhamster.<wbr>org</a><br>
<a href="http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org" rel="noreferrer" target="_blank">http://lists.motherhamster.<wbr>org/listinfo.cgi/ohrrpgce-<wbr>motherhamster.org</a><br>
<br></blockquote></div><br></div>