Comments (4)
I don't think this is a bug because the docs for ^
says.
If y is a negative integer literal, then
Base.literal_pow transforms the operation to inv(x)^-y by default, where -y is
positive.
and inv(-1)
is -1.0
I think the reason for this is so that functions like foo(x::Int) = x^-1
are type stable.
from julia.
IMO the problem is, that literal_pow(x, Val{-1})
cannot be type stable and at the same time behave like x^Int(-1)
, because the latter throws DomainError
for x = 2
while the first is supposed to return 0.5
.
In order to be type stable, it has to return 1.0
for x = 1
then.
from julia.
the problem here is that one of the fundamental properties of literal pow is that it doesn't change the results for inputs where x^y returns an answer.
from julia.
I'm removing the "bug" label since this is the intended behavior for negative literal powers, regardless of the base, and it's not clear whether anything can or should be changed here in a type-stable way.
from julia.
Related Issues (20)
- `TOML.print` generates invalid TOML on stdout when the values include multiline strings HOT 1
- Function alias of `Base.Cartesian.@nif`
- 2x regression in indexing benchmarks due to 'Remove references to non opaque pointers in codegen and LLVM passes (#54853)' HOT 3
- ERROR: LoadError: UndefVarError: `UUIDs` not defined. HOT 5
- Possible improvement in memory used in storage of a `Union` of immutable structs?
- Enable opt-in recursive constant propagation HOT 2
- Common code not included in optionally-generated function HOT 8
- Stack overflow during type inference HOT 8
- Regression 1.9 -> 1.10: `getproperty` 3x longer HOT 2
- [LinearAlgebra] Wrong positive definite check when performing Cholesky decomposition HOT 3
- Assertion failure inside rr causing test x86_64-linux-gnuassertrr to fail HOT 2
- Impossible values of allunique() and allequal() HOT 3
- `permute_dims` fails in edge case because of use if `1:length`
- Documentation example not behaving as displayed - behavior of "const" on immutable objects. HOT 1
- Make precise semantics of world-age increments in top-level thunks
- New precompilation crashes on Julia 1.11-rc1 HOT 68
- introduce a function to check whether a value can be represented as a type HOT 5
- Plots package doesn't work HOT 2
- suboptimal abstract return type inference involving `getindex(::Tuple)` HOT 1
- Improvements to `JULIA_CPU_TARGET` and its documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from julia.