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

Division error with long double #650

Closed
codinguncut opened this issue Oct 17, 2012 · 3 comments
Closed

Division error with long double #650

codinguncut opened this issue Oct 17, 2012 · 3 comments

Comments

@codinguncut
Copy link

#include <stdio.h>

int main()
{
  unsigned long ips = 4000000;
  double m_ips;
  m_ips = ((double)ips) / 1000000.0L;
  printf("m_ips %f\n", m_ips);
}

gcc division.c && ./a.out

m_ips 4.000000

emcc division.c -o division.js && node division.js

Warning: .ll contains floating-point values with more than 64 bits. Faking values for them. If they are used, this will almost certainly break horribly!
m_ips -0.000000

I am aware a warning is displayed in above code, but in multiple places in the documentation is it noted that this warning is not known to have any averse effects ;)

System

emscripten: git repo Tue Sep 11 19:28:48 2012 -0700
llvm: 3.1
node: v0.8.12
gcc: gcc (Ubuntu/Linaro 4.7.2-1ubuntu1) 4.7.2
uname -a
Linux Lorax 3.5.0-15-generic #22-Ubuntu SMP Wed Sep 19 20:06:19 UTC 2012 i686 i686 i686 GNU/Linux
Ubuntu quantal
cpu/system: Intel(R) Core(TM)2 Duo CPU     U9600  @ 1.60GHz
@kripken
Copy link
Member

kripken commented Oct 18, 2012

The compiler warns on floats larger than 64 bits - there is an x86_fp80 (80-bit x86 float) there, which is what the clang frontend does to long doubles. We can't support that.

The long-term fix is to make a clang frontend that does not have this problem, that is, that makes long double mean 64 bits.

@manuels
Copy link
Contributor

manuels commented Aug 31, 2013

I just tested this bug with the upstream branch.
Looks like it's fixed.

If you can confirm it, you can close it.

@kripken
Copy link
Member

kripken commented Sep 3, 2013

Yes, we switched meanwhile to an llvm target without long double issues, so this should indeed be fixed.

@kripken kripken closed this as completed Sep 3, 2013
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