-
Notifications
You must be signed in to change notification settings - Fork 7
What we need #1
Comments
Thanks for putting this together! This will certainly be a fun one. 😄 Any idea how much of your Libm.jl code you're planning to bring over here, if any? |
A few of these are already implemented in Base in native Julia, right? We should probably port those over here or at least check them off the list here. |
Do we not need bessel functions anymore? |
How do I access the intrinsics? |
|
I should say, this wasn't intended to be a definitive list:
|
Personally, I think these might be a good candidate for SpecialFunctions.jl |
I'll have to look: a lot of it is quite old, but if you see anything you would like, feel free to copy it over. |
Base is using a julia implementation of hypot https://github.com/JuliaLang/julia/blob/2d24eda52727c6cbccec935d689d84d710366f5a/base/math.jl#L194 |
They're already there. 😄 |
I think the error and gamma functions would make more sense in SpecialFunctions.jl. |
Base is using a julia implementation of so |
Julia is using the LLVM intrinsic remainder ( It is Julia also has its nan's defined. So the C |
Actually |
on the checkbox |
The intrinsic still exist, but it will not be lowered to a single hardware instruction. http://llvm.org/docs/LangRef.html#llvm-fma-intrinsic |
My bad. |
|
Right, in that file it selects the software fma provided by openlibm if the intrinsics are not accurate enough. At the end of the day we need a software fma in pure julia to replace that, which is what I meant to say. |
Actually, it's a little more complicated than that. The LLVM fma intrinsic will fall back to the LLVM-linked libm (which is usually the system libm). The problem is that on old glibc versions, this clobbered the rounding mode which caused all sorts of havoc (see JuliaLang/julia#9847). So instead we now call the openlibm fma function if we don't think there's a native fma (which is what that line you link to is trying to test). |
Aren't |
Is there an llvm intrinsic that does round nearest away (i.e. 2.5 ->3.0 and -2.5 -> -3.0)? rint_llvm rounds nearest towards. Currently, I use rint{T<:FloatTypes}(x::T) = ifelse(x < 0, x - T(0.5), x + T(0.5)) But it's not as good as a single vroundsd instruction using round |
Looking at: http://support.amd.com/TechDocs/26568.pdf there doesn't seem to be an instruction that does round away from zero Edit: upon closer inspection, there isn't actually a need in any of the algorithms to have the rounding behave this way. As a result, i'm transitioning to use round in the code. |
Should And |
Dang. You guys have been really making moves here. |
@StefanKarpinski this is largely irrelevant now for Amal, and only applies to https://github.com/JuliaMath/Sleef.jl I should close this and open another one relevant to Amal. Sleef has important limitations in regards to performance and that was the reason I decided to start from scratch. |
The following functions are defined in the C 2011 standard, under math.h. We probably don't need all of these as some (such as trunc or round) are better provided by LLVM intrinsics.
Trig functions
Hyperbolic functions
Exponential and logarithmic
Power and absolute value
fabs: use intrinsicsqrt: use intrinsicNearest integer
ceilfloorroundtruncrintnearbyintRemainder functions
Manipulation
copysign: use intrinsicMaximum, minimum
fma: use intrinsicThe text was updated successfully, but these errors were encountered: