How to round 1.653782960785311e14 to 1.65e14?

`julia> a
1.653782960785311e14

julia> round(a,2)
1.653782960785311e14
`
how to round 1.653782960785311e14 to 1.66e14 ?
Paul

signif(1.653782960785311e14,3)
3 Likes

That reads as “sign if” to me.

6 Likes

Thanks, For all array not works , is something for array ?
Like:

signif(rand(5),3)
ERROR: MethodError: no method matching signif(::Array{Float64,1}, ::Int64)
Closest candidates are:
signif(::Real, ::Integer) at floatfuncs.jl:136
signif(::Real, ::Integer, ::Integer) at floatfuncs.jl:136
paul
W dniu 2018-03-27 o 21:56, Simon Byrne pisze:

try signif.(rand(5),3))
which will boadcast the operation

Same here :wink: so much for terse function names…

1 Like

+1

Can someone translate how I should read it correctly? Why it isn’t round?

I guess we pronounce it as signif-icant.

help?> signif
search: signif significand signbit

  signif(x, digits, [base])

  Rounds (in the sense of round) x so that there are digits significant digits, under a base base representation, default 10.
  E.g., signif(123.456, 2) is 120.0, and signif(357.913, 4, 2) is 352.0.

signif is too short, better is sigdigits [sigdigs if you must])

2 Likes

“signif” is what R calls it, fwiw: https://stat.ethz.ch/R-manual/R-devel/library/base/html/Round.html

1 Like

its worth very little to those of us who are pleased to have let go of R :grinning:

(glad you are around, Harlan)

It probably should be a method of round if someone wants to open an issue.

1 Like

https://github.com/JuliaLang/julia/issues/26663