Giter VIP home page Giter VIP logo

Comments (9)

mikeingold avatar mikeingold commented on August 29, 2024

I just found a related bug report on the Unitful.jl package repo.

from quadgk.jl.

stevengj avatar stevengj commented on August 29, 2024

The funny thing is that it is failing on:

  [2] one(#unused#::Type{Quantity{Float64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}}  )
    @ Base .\number.jl:334

which is this fallback method of one(T). That seems like Unitful's fault β€” it should really be dispatching to a one method in Unitful.

from quadgk.jl.

stevengj avatar stevengj commented on August 29, 2024

I just tried it with the latest versions (QuadGK 2.6.0 and Unitful v1.12.2) in Julia 1.8.2, and it works fine for me:

julia> using Unitful, QuadGK

julia> f(t) = 1.0u"J"
f (generic function with 1 method)

julia> quadgk(f, 0.0u"s", 10.0u"s")
(10.0 J s, 0.0 J s)

So something is weird on your system?

from quadgk.jl.

stevengj avatar stevengj commented on August 29, 2024

Hmm, interesting. I can sometimes reproduce your error. If I enter the code above line-by-line, it works. But if I paste it in all at once, then I get the error. This seems like a bug in Julia, TBH.

from quadgk.jl.

stevengj avatar stevengj commented on August 29, 2024

Aha, I just noticed that the difference between your code and mine: I was doing using Unitful, QuadGK whereas you were doing using QuadGK, Unitful.

It seems like this is a bug in Julia, since it dispatch shouldn't depend on the order of the imports: JuliaLang/julia#48295

from quadgk.jl.

mikeingold avatar mikeingold commented on August 29, 2024

Fascinating. I can reproduce the import-order issue that you detected in both a prior install of Julia v1.7.3 and a fresh install of Julia Version 1.9.0-beta2, Commit 7daffeecb8 (2022-12-29 07:45 UTC) with only those two packages added.

from quadgk.jl.

stevengj avatar stevengj commented on August 29, 2024

Should be fixed now.

from quadgk.jl.

mikeingold avatar mikeingold commented on August 29, 2024

Awesome. Thanks!

from quadgk.jl.

giordano avatar giordano commented on August 29, 2024

Maybe could add a test?

from quadgk.jl.

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.