Skip to content

Norm of a vector is Inf but it should not be #1116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andreasvarga opened this issue Dec 30, 2022 · 4 comments
Closed

Norm of a vector is Inf but it should not be #1116

andreasvarga opened this issue Dec 30, 2022 · 4 comments

Comments

@andreasvarga
Copy link

using LinearAlgebra
using StaticArrays
b =    [-4.744752769108950e-01                                                                                                                        
           4.245762257203441e+290]
bs = SA[-4.744752769108950e-01                                                                                                                        
           4.245762257203441e+290]
norm(b)
4.245762257203441e290
norm(bs)
Inf

The norms must be same, but are not.

@hyrodium
Copy link
Collaborator

This is a duplicate of #913.

@andreasvarga
Copy link
Author

I agree, this is a similar case. But then, why is this problem not yet fixed?

@hyrodium
Copy link
Collaborator

#975 will fix this issue, and the PR is just waiting for some reviews.

julia> using LinearAlgebra, StaticArrays

julia> b =    [-4.744752769108950e-01                                                                                                                        
                  4.245762257203441e+290]
2-element Vector{Float64}:
 -0.474475276910895
  4.245762257203441e290

julia> bs = SA[-4.744752769108950e-01                                                                                                                        
                  4.245762257203441e+290]
2-element SVector{2, Float64} with indices SOneTo(2):
 -0.474475276910895
  4.245762257203441e290

julia> norm(b)
4.245762257203441e290

julia> norm(bs)
4.245762257203441e290

I will try making time to review the PR within a week.

@hyrodium
Copy link
Collaborator

hyrodium commented Feb 9, 2023

This issue is now fixed in v1.5.13.
https://github.com/JuliaArrays/StaticArrays.jl/releases/tag/v1.5.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants