Skip to content

Portability fixes#74

Merged
ViralBShah merged 6 commits intoJuliaMath:masterfrom
NuxiNL:master
Jan 8, 2015
Merged

Portability fixes#74
ViralBShah merged 6 commits intoJuliaMath:masterfrom
NuxiNL:master

Conversation

@EdSchouten
Copy link
Copy Markdown
Contributor

Hi there,

I'm currently working on getting openlibm working in an alternative POSIX-like environment which I'm planning on releasing in a couple of months from now. It seems the code builds pretty well, though I needed to tweak it in a couple of places.

Attached are a couple of cleanups that are needed to get openlibm to build.

Ed

This test is also present in FreeBSD's <machine/ieeefp.h>. For FreeBSD
it makes sense, but for a portable math library, we cannot assume that
the system has a header file like <sys/cdefs.h> and that it uses a
common header guard.
The finite() function has been superseded by isfinite(). There is also
no need to use scalb(), as the exponent is also an integer value. We can
simply use scalbn().

There is also no need to use __isnanf(). The values passed are
guaranteed to be of type float, meaning we can safely use the standard
isnan().
It seems that this header conditionally tests whether <complex.h> is
included, as the 'complex' keyword is otherwise not available. This
version of math_private.h includes <complex.h> unconditionally, so there
is no need to test against this.
__ISO_C_VISIBLE is already defined on FreeBSD. By default, it has a
value of 2011. This causes a lot of compiler warnings.
<sys/cdefs.h> is not a standard header. Instead, we'd better pull in a
common header like <stdio.h>. It is very likely that such a header
already provides the necessary bits.
Instead of using all sorts of operating system specific constructs, we
can just query the compiler which byte order is being used. This has the
advantage that the code builds on new platforms without any tweaks.
@EdSchouten
Copy link
Copy Markdown
Contributor Author

It seems that even though the code builds on OS X, the tests fail. My suspicion is that this is unrelated to this change, as the previous build also failed this way.

@Keno
Copy link
Copy Markdown
Contributor

Keno commented Jan 7, 2015

Yes, the OS X tests are borked.

@ViralBShah
Copy link
Copy Markdown
Member

Thanks. These are a nice set of changes.

The mac tests need to be fixed, so that we can get a travis green. They have always been this way, but with Travis enabled now, we can't ignore it any more. One possibility could be to just do the compilation of the library, and run the tests after they are fixed to pass.

ViralBShah added a commit that referenced this pull request Jan 8, 2015
@ViralBShah ViralBShah merged commit 0b2a647 into JuliaMath:master Jan 8, 2015
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

Successfully merging this pull request may close these issues.

3 participants