Giter Site home page Giter Site logo

Comments (4)

ovillellas avatar ovillellas commented on July 22, 2024

I described this same problem in a comment inside the "problems with castings". If you try to get the same ndot generated for float32 it will fail even if s is 0.0, because numba it is not able to downcast to single precision what it sees like a double literal :(.

from numba.

jriehl avatar jriehl commented on July 22, 2024

With the last commit, I'm able to get both the s = 0 and float32 versions of ndot to compile. Note that in the s = 0 case, the type of s is inferred to be an integer, so the input floating point values are being truncated, and the result is then cast to a floating point when being written to the output array.

The big problem with supporting the kind of type inference you want is loops. To keep things sane, I use the first observed type for values that have to be joined at branch targets (phi nodes in static single assignment lingo). Doing a more sophisticated static analysis might work. We'll have to look into it in more depth.

I'm not sure if I should close this issue and add an enhancement issue (since technically compilation is no longer broken), or re-purpose this issue for the enhancement. Opinions?

from numba.

stefanv avatar stefanv commented on July 22, 2024

It probably depends on whether you see behaviour different to that of default Python to be a bug or not?

from numba.

markflorisson avatar markflorisson commented on July 22, 2024

This is fixed now with the SSA support, probably to the extent where Python compatibility remains feasible.

from numba.

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.