Giter Club home page Giter Club logo

Comments (12)

StefanKarpinski avatar StefanKarpinski commented on May 4, 2024

Are there implementations available for those five functions? IIRC you said they were all rounding functions. Maybe LLVM has trustworthy intrinsics for those operations — rounding is pretty unambiguous.

from julia.

JeffBezanson avatar JeffBezanson commented on May 4, 2024

No, LLVM does not have those as intrinsics, and as far as I can tell the intrinsics LLVM does have just call libm.
We can get implementations from BSD.

from julia.

JeffBezanson avatar JeffBezanson commented on May 4, 2024

Oh, llvm-config has us linking with -lm, so we won't be able to remove it. Not a big deal.

from julia.

JeffBezanson avatar JeffBezanson commented on May 4, 2024

Those two fixed, but we are also missing tgamma.

from julia.

StefanKarpinski avatar StefanKarpinski commented on May 4, 2024

tgamma is called gamma — I added it the other day. We can make tgamma be an alias, but that seems like a historical accident due to a mistake that it would be fairly silly to inherit from C.

from julia.

JeffBezanson avatar JeffBezanson commented on May 4, 2024

Sure, it's called gamma in julia, but what we're missing is the actual implementation of tgamma in fdlibm:

julia> gamma(2)
dlsym: /home/jeff/src/julia2/julia/lib/libfdm.so: undefined symbol: tgamma

from julia.

StefanKarpinski avatar StefanKarpinski commented on May 4, 2024

That's weird. Mine work — I tested them before making that commit:

julia> gamma(4.5)
11.6317283965674498

julia> gamma(float32(4.5))
11.63172817

from julia.

JeffBezanson avatar JeffBezanson commented on May 4, 2024

It must be finding the symbol from libm somehow. grep tgamma * in fdlibm/ is empty. Maybe try ldd and nm on libfdm.dylib.

from julia.

StefanKarpinski avatar StefanKarpinski commented on May 4, 2024

Ah, yeah, that's really strange. This would be found if we could force LLVM not to link against libm since then there would be no tgamma at all to link to.

My understanding is that gamma is deprecated in favor of tgamma because historically, on some systems gamma was the log-gamma function whereas on other systems it was just the gamma function. The only way to guarantee that the implementation and the intended usage were in agreement was to deprecate gamma and have tgamma replace it as unambiguously meaning the non-log gamma function.

So as long as the fdlibm we include has a gamma function that means tgamma, we can just use its gamma function. But given the mislinking above, I'm a little afraid to do that. If we can get rid of the -lm under llvm-config, that would work. Alternatively, we can just fork fdlibm's code and rename gamma to tgamma everywhere.

from julia.

StefanKarpinski avatar StefanKarpinski commented on May 4, 2024

Let me know if 9d1009f fixes this for you, Jeff. I can't test since it was already working for me.

from julia.

JeffBezanson avatar JeffBezanson commented on May 4, 2024

Stefan, that commit is shameful. You didn't even look at the code. fdlibm uses the old naming convention where "gamma" means log-gamma. Its "gamma" just calls lgamma.

from julia.

StefanKarpinski avatar StefanKarpinski commented on May 4, 2024

Ugh. Sorry. That is really embarrassing. I was somehow still linking against the libm version, so I was getting apparently correct results. I'll endeavor to find a working tgamma implementation to plug in here...

from julia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.