~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to base/number.jl

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-01-16 12:29:42 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130116122942-x86e42akjq31repw
Tags: 0.0.0+20130107.gitd9656f41-1
* New upstream snashot
* No longer try to rebuild helpdb.jl.
   + debian/rules: remove helpdb.jl from build-arch rule
   + debian/control: move back python-sphinx to Build-Depends-Indep
* debian/copyright: reflect upstream changes
* Add Build-Conflicts on libatlas3-base (makes linalg tests fail)
* debian/rules: replace obsolete USE_DEBIAN makeflag by a list of
  USE_SYSTEM_* flags
* debian/rules: on non-x86 systems, use libm instead of openlibm
* dpkg-buildflags.patch: remove patch, applied upstream
* Refreshed other patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
ndims{T<:Number}(::Type{T}) = 0
21
21
length(x::Number) = 1
22
22
ref(x::Number) = x
 
23
ref(x::Number, i::Integer) = i == 1 ? x : throw(BoundsError())
 
24
ref(x::Number, i::Real) = ref(x, to_index(i))
23
25
 
24
26
signbit(x::Real) = int(x < 0)
25
27
sign(x::Real) = x < 0 ? -one(x) : x > 0 ? one(x) : x
32
34
inv(x::Number) = one(x)/x
33
35
angle(z::Real) = atan2(zero(z), z)
34
36
 
35
 
# TODO: should we really treat numbers as iterable?
36
37
start(a::Real) = a
37
38
next(a::Real, i) = (a, a+1)
38
39
done(a::Real, i) = (i > a)
40
41
contains(s::Number, n::Number) = (s == n)
41
42
 
42
43
reinterpret{T<:Real}(::Type{T}, x::Real) = box(T,x)
 
44
 
 
45
map(f, x::Number) = f(x)