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

exp and log yield zero compensation term #6

Open
amigalemming opened this issue Oct 1, 2015 · 4 comments
Open

exp and log yield zero compensation term #6

amigalemming opened this issue Oct 1, 2015 · 4 comments

Comments

@amigalemming
Copy link

Prelude Numeric.Compensated> exp 1 :: Compensated Double
compensated 2.718281828459045 0.0
Prelude Numeric.Compensated> log 2 :: Compensated Double
compensated 0.6931471805599453 0.0

That's not quite correct, isn't it?

@axman6
Copy link

axman6 commented Feb 14, 2017

I've been looking into properly implementing exp etc. in compensated today, but it looks like there's going to be some pretty big changes, like defining that e (i.e. exp 1) is for each Compensable type, and figuring out what the generic algorithm is for the general case. This is based on the C++ source of Quad-Double Arithmetic: Algorithms, Implementation, and Application. Sadly I have a feeling I will be running into the limits of my knowledge pretty quickly.

@shlok
Copy link

shlok commented Jun 28, 2017

@axman6 Interesting. The paper you mentioned talks about quad-Double arithmetic. Are you sure it can be applied to this compensated library? I ask because Compensated can be iterated to even more precision than quad-Double: Compensated (Compensated Double), Compensated (Compensated (Compensated Double)), etc.

@axman6
Copy link

axman6 commented Jun 28, 2017

@shlok I believe it should be possible to do in general, but i'm not smart enough to know how to do it in the general case :) even if we do have an inefficient general algorithm, we can also write the efficient impelmentations for Compensated^{1,2,3}, likely the most common use cases, and use RULES to get them used at compile time.

@shlok
Copy link

shlok commented Jun 28, 2017

@axman6 Yeah, that would be cool. Unfortunately, I don't have the expertise to implement it either. In the meantime, it looks like qd has double-double and quad-double data types. BigFloat is another option, although it doesn’t seem usable with storable/unboxed vectors. (One reason I was drawn to compensated is that it seems usable with both storable and unboxed vectors. If only this was a complete library 🙂.)

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