Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MrC Floating point division broken #32

Closed
steventroughtonsmith opened this issue Dec 13, 2017 · 6 comments
Closed

MrC Floating point division broken #32

steventroughtonsmith opened this issue Dec 13, 2017 · 6 comments

Comments

@steventroughtonsmith
Copy link

Hey there! I'm seeing a reproducible MrC bug with mpw 0.8.0/MrC C Compiler 4.1.0f1c1; floating point division does not work properly.

test.c

#include <stdio.h>

int main()
{
   float SCALE = 1.0f/16.0f;
   printf("Scale = %f", SCALE);
   return 0;
}

Compiling

mpw MrC test.c
mpw PPCLink test.c.o {SharedLibraries}StdCLib {PPCLibraries}StdCRuntime.o {PPCLibraries}PPCCRuntime.o -o test

With the above, running MrC on real hardware emits code that prints '0.062500'. Running MrC under mpw prints '625.000000'.

I am running a slightly older build of mpw so my apologies if you're already on top of this! =)

mpw-orig
mpw-ksherlock

@ksherlock
Copy link
Owner

Could be worse... SC compiles it down to 0.807692 or 062500.000000, depending on if it's a compile time constant or not.

@steventroughtonsmith
Copy link
Author

Aha! Not just me then 🙃 So it's not just the one tool, rather something in the emulation outright? Anything I can do to help triage?

@carfesh
Copy link

carfesh commented Dec 14, 2017

I haven't looked into it much, but Petter recently committed a fix for 64-bit division in the WinFellow code - you might try and see if this fixes it?

petschau/WinFellow@f5eeb1a

@steventroughtonsmith
Copy link
Author

I can confirm that the above patch does not fix the issue here, from what I can tell.

@ksherlock
Copy link
Owner

I fixed some problems with the SANE FX2DEC formatting which should fix this issue (but not the 1.0/16.0 = 0.807692 SC issue).

mpw-0.8.2.zip

@steventroughtonsmith
Copy link
Author

It works! Safe to close this on my end. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants