![]() |
Odd error - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: Odd error (/showthread.php?tid=437) |
Odd error - britlion - 02-27-2012 This might be another float bug. I wrote up the distance algorithm na_th_an showed us. It seems to work - but in this test program, it's the floating point values that go wrong... If you set your emulator to full speed, you see it looking for the biggest error it can find, showing larger errors as it finds them. Eventually it hits distance (250,56) which my function says is > 255 (so returns 255). The value calculated from square rooting in floats is...er 0. So that's an error of 255, apparently. Except the correct answer would be 256.1952 Is the int (256) returning 0 for some reason? On a float? When I'm happy with this funtion, it will go in the function library as a code snippet. Code: FUNCTION fastcall distance (a as ubyte, b as ubyte) as uByte Re: Odd error - LCD - 02-28-2012 If the Answer is defined as uByte, then 256 is 0... No Error of ZXBC I guess. Re: Odd error - britlion - 02-29-2012 Float, Jose LCD. Float: Britlion Wrote:The value calculated from square rooting in floats is...er 0. So that's an error of 255, apparently. Except the correct answer would be 256.1952 The ubyte bit is coming out nicely. I was baffled by the float version of the calculation, here. I changed how it all worked anyway, so it might not matter. I did wonder if it was pointing to an odd bug, though. Re: Odd error - boriel - 02-29-2012 britlion Wrote:Float, Jose. Float:Uh:?: I haven't said a word... yet. :roll: Re: Odd error - britlion - 02-29-2012 Ah. Fundamental problem. I can't read. Apart from that, carry on as normal. Re: Odd error - britlion - 04-06-2012 No comment if this is a bug? Did it go away? |