Skip to content
Browse files

rename Float -> FloatingPoint

  • Loading branch information...
1 parent 940e328 commit cfaf2d2a618f0a58d2e05eb99446c44d886f14dc @nolta nolta committed Aug 29, 2012
View
4 base/array.jl
@@ -165,7 +165,7 @@ function fill!{T<:Union(Int8,Uint8)}(a::Array{T}, x::Integer)
ccall(:memset, Void, (Ptr{T}, Int32, Int), a, x, length(a))
return a
end
-function fill!{T<:Union(Integer,Float)}(a::Array{T}, x)
+function fill!{T<:Union(Integer,FloatingPoint)}(a::Array{T}, x)
if isa(T,BitsKind) && convert(T,x) == 0
ccall(:memset, Ptr{T}, (Ptr{T}, Int32, Int32), a,0,length(a)*sizeof(T))
else
@@ -1427,7 +1427,7 @@ function sum{T}(A::StridedArray{T})
v
end
-function sum{T<:Float}(A::StridedArray{T})
+function sum{T<:FloatingPoint}(A::StridedArray{T})
n = length(A)
if (n == 0)
return zero(T)
View
8 base/boot.jl
@@ -122,7 +122,7 @@ import Root
export ..., ANY, ASCIIString, AbstractArray, AbstractKind, Any, Array,
BitsKind, Bool, BoundsError, Box, ByteString, Char, CompositeKind,
Core, Root, DirectIndexString, DivideByZeroError, DomainError, EOFError,
- Exception, Expr, Float, Float32, Float64, Function, GotoNode, IOError,
+ Exception, Expr, FloatingPoint, Float32, Float64, Function, GotoNode, IOError,
InexactError, Integer, Int, Int8, Int16, Int32, Int64, Int128,
InterruptException,
IntrinsicFunction, LabelNode, LambdaStaticData, LineNumberNode,
@@ -164,13 +164,13 @@ const (===) = is
abstract Number
abstract Real <: Number
-abstract Float <: Real
+abstract FloatingPoint <: Real
abstract Integer <: Real
abstract Signed <: Integer
abstract Unsigned <: Integer
-bitstype 32 Float32 <: Float
-bitstype 64 Float64 <: Float
+bitstype 32 Float32 <: FloatingPoint
+bitstype 64 Float64 <: FloatingPoint
bitstype 8 Bool <: Integer
bitstype 32 Char <: Integer
View
10 base/complex.jl
@@ -26,7 +26,7 @@ function _jl_show(io, z::Complex, compact::Bool)
end
compact ? showcompact(io, i) : show(io, i)
if !(isa(i,Integer) || isa(i,Rational) ||
- isa(i,Float) && isfinite(i))
+ isa(i,FloatingPoint) && isfinite(i))
print(io, "*")
end
print(io, "im")
@@ -117,10 +117,10 @@ sizeof(::Type{Complex64}) = 8
complex(x::Float64, y::Float64) = complex128(x, y)
complex(x::Float32, y::Float32) = complex64(x, y)
-complex(x::Float, y::Float) = complex(promote(x,y)...)
-complex(x::Float, y::Real) = complex(promote(x,y)...)
-complex(x::Real, y::Float) = complex(promote(x,y)...)
-complex(x::Float) = complex(x, zero(x))
+complex(x::FloatingPoint, y::FloatingPoint) = complex(promote(x,y)...)
+complex(x::FloatingPoint, y::Real) = complex(promote(x,y)...)
+complex(x::Real, y::FloatingPoint) = complex(promote(x,y)...)
+complex(x::FloatingPoint) = complex(x, zero(x))
## complex with arbitrary component type ##
View
2 base/datafmt.jl
@@ -164,7 +164,7 @@ function dlmwrite(io, a::Matrix, dlm::Char)
for i = 1:nr
for j = 1:nc
elt = a[i,j]
- if isa(elt,Float)
+ if isa(elt,FloatingPoint)
print_shortest(io, elt)
else
print(io, elt)
View
2 base/dict.jl
@@ -162,7 +162,7 @@ else
end
hash(x::Integer) = _jl_hash64(uint64(x))
-@eval function hash(x::Float)
+@eval function hash(x::FloatingPoint)
if trunc(x) == x
# hash as integer if equal to some integer. note the result of
# float to int conversion is only defined for in-range values.
View
48 base/float.jl
@@ -24,20 +24,20 @@ convert(::Type{Float64}, x::Uint32) = box(Float64,uitofp64(unbox(Uint32,x)))
convert(::Type{Float64}, x::Uint64) = box(Float64,uitofp64(unbox(Uint64,x)))
convert(::Type{Float64}, x::Float32) = box(Float64,fpext64(unbox(Float32,x)))
-convert(::Type{Float}, x::Bool) = convert(Float32, x)
-convert(::Type{Float}, x::Char) = convert(Float32, x)
-convert(::Type{Float}, x::Int8) = convert(Float32, x)
-convert(::Type{Float}, x::Int16) = convert(Float32, x)
-convert(::Type{Float}, x::Int32) = convert(Float64, x)
-convert(::Type{Float}, x::Int64) = convert(Float64, x) # LOSSY
-convert(::Type{Float}, x::Uint8) = convert(Float32, x)
-convert(::Type{Float}, x::Uint16) = convert(Float32, x)
-convert(::Type{Float}, x::Uint32) = convert(Float64, x)
-convert(::Type{Float}, x::Uint64) = convert(Float64, x) # LOSSY
+convert(::Type{FloatingPoint}, x::Bool) = convert(Float32, x)
+convert(::Type{FloatingPoint}, x::Char) = convert(Float32, x)
+convert(::Type{FloatingPoint}, x::Int8) = convert(Float32, x)
+convert(::Type{FloatingPoint}, x::Int16) = convert(Float32, x)
+convert(::Type{FloatingPoint}, x::Int32) = convert(Float64, x)
+convert(::Type{FloatingPoint}, x::Int64) = convert(Float64, x) # LOSSY
+convert(::Type{FloatingPoint}, x::Uint8) = convert(Float32, x)
+convert(::Type{FloatingPoint}, x::Uint16) = convert(Float32, x)
+convert(::Type{FloatingPoint}, x::Uint32) = convert(Float64, x)
+convert(::Type{FloatingPoint}, x::Uint64) = convert(Float64, x) # LOSSY
float32(x) = convert(Float32, x)
float64(x) = convert(Float64, x)
-float(x) = convert(Float, x)
+float(x) = convert(FloatingPoint, x)
## conversions from floating-point ##
@@ -72,8 +72,8 @@ iround(::Type{Uint64}, x::Float64) = box(Uint64,fpuiround64(unbox(Float64,x)))
# this is needed very early because it is used by Range and colon
floor(x::Float64) = ccall(dlsym(_jl_libfdm,:floor), Float64, (Float64,), x)
-iceil(x::Float) = itrunc(ceil(x)) # TODO: fast primitive for iceil
-ifloor(x::Float) = itrunc(floor(x)) # TOOD: fast primitive for ifloor
+iceil(x::FloatingPoint) = itrunc(ceil(x)) # TODO: fast primitive for iceil
+ifloor(x::FloatingPoint) = itrunc(floor(x)) # TOOD: fast primitive for ifloor
## floating point promotions ##
@@ -140,10 +140,10 @@ isequal(x::Float64, y::Float64) = fpiseq64(unbox(Float64,x),unbox(Float64,y))
isless (x::Float32, y::Float32) = fpislt32(unbox(Float32,x),unbox(Float32,y))
isless (x::Float64, y::Float64) = fpislt64(unbox(Float64,x),unbox(Float64,y))
-isequal(a::Integer, b::Float) = (a==b) & isequal(float(a),b)
-isequal(a::Float, b::Integer) = isequal(b, a)
-isless (a::Integer, b::Float) = (a<b) | isless(float(a),b)
-isless (a::Float, b::Integer) = (a<b) | isless(a,float(b))
+isequal(a::Integer, b::FloatingPoint) = (a==b) & isequal(float(a),b)
+isequal(a::FloatingPoint, b::Integer) = isequal(b, a)
+isless (a::Integer, b::FloatingPoint) = (a<b) | isless(float(a),b)
+isless (a::FloatingPoint, b::Integer) = (a<b) | isless(a,float(b))
==(x::Float64, y::Int64 ) = eqfsi64(unbox(Float64,x),unbox(Int64,y))
==(x::Float64, y::Uint64 ) = eqfui64(unbox(Float64,x),unbox(Uint64,y))
@@ -187,8 +187,8 @@ const NaN = box(Float64,unbox(Uint64,0x7ff8000000000000))
nan(::Type{Float32}) = $NaN32
inf(::Type{Float64}) = $Inf
nan(::Type{Float64}) = $NaN
- inf{T<:Float}(x::T) = inf(T)
- nan{T<:Float}(x::T) = nan(T)
+ inf{T<:FloatingPoint}(x::T) = inf(T)
+ nan{T<:FloatingPoint}(x::T) = nan(T)
isdenormal(x::Float32) = (abs(x) < $box(Float32,unbox(Uint32,0x00800000)))
isdenormal(x::Float64) = (abs(x) < $box(Float64,unbox(Uint64,0x0010000000000000)))
@@ -204,17 +204,17 @@ const NaN = box(Float64,unbox(Uint64,0x7ff8000000000000))
realmin(::Type{Float64}) = $box(Float64,unbox(Uint64,0x0010000000000000))
realmax(::Type{Float32}) = $box(Float32,unbox(Uint32,0x7f7fffff))
realmax(::Type{Float64}) = $box(Float64,unbox(Uint64,0x7fefffffffffffff))
- realmin{T<:Float}(x::T) = realmin(T)
- realmax{T<:Float}(x::T) = realmax(T)
+ realmin{T<:FloatingPoint}(x::T) = realmin(T)
+ realmax{T<:FloatingPoint}(x::T) = realmax(T)
realmin() = realmin(Float64)
realmax() = realmax(Float64)
nextfloat(x::Float32, i::Integer) = box(Float32,add_int(unbox(Float32,x),unbox(Int32,int32(i))))
nextfloat(x::Float64, i::Integer) = box(Float64,add_int(unbox(Float64,x),unbox(Int64,int64(i))))
- nextfloat(x::Float) = nextfloat(x,1)
- prevfloat(x::Float) = nextfloat(x,-1)
+ nextfloat(x::FloatingPoint) = nextfloat(x,1)
+ prevfloat(x::FloatingPoint) = nextfloat(x,-1)
- eps(x::Float) = isfinite(x) ? abs(nextfloat(x)-x) : nan(x)
+ eps(x::FloatingPoint) = isfinite(x) ? abs(nextfloat(x)-x) : nan(x)
eps(::Type{Float32}) = $box(Float32,unbox(Uint32,0x34000000))
eps(::Type{Float64}) = $box(Float64,unbox(Uint64,0x3cb0000000000000))
eps() = eps(Float64)
View
10 base/floatfuncs.jl
@@ -3,15 +3,15 @@
abs(x::Float64) = box(Float64,abs_float(unbox(Float64,x)))
abs(x::Float32) = box(Float32,abs_float(unbox(Float32,x)))
-isnan(x::Float) = (x != x)
+isnan(x::FloatingPoint) = (x != x)
isnan(x::Real) = isnan(float(x))
isnan(x::Integer) = false
-isinf(x::Float) = (abs(x) == Inf)
+isinf(x::FloatingPoint) = (abs(x) == Inf)
isinf(x::Real) = isinf(float(x))
isinf(x::Integer) = false
-isfinite(x::Float) = (x-x == 0)
+isfinite(x::FloatingPoint) = (x-x == 0)
isfinite(x::Real) = isfinite(float(x))
isfinite(x::Integer) = true
@@ -26,10 +26,10 @@ signbit(x::Float32) = signbit(reinterpret(Int32,x))
maxintfloat(::Type{Float64}) = 9007199254740992.
maxintfloat(::Type{Float32}) = float32(16777216.)
-maxintfloat{T<:Float}(x::T) = maxintfloat(T)
+maxintfloat{T<:FloatingPoint}(x::T) = maxintfloat(T)
maxintfloat() = maxintfloat(Float64)
-integer_valued(x::Float) = (trunc(x)==x)&isfinite(x)
+integer_valued(x::FloatingPoint) = (trunc(x)==x)&isfinite(x)
sqrt(x::Real) = sqrt(float(x))
sin(x::Real) = sin(float(x))
View
8 base/grisu.jl
@@ -48,7 +48,7 @@ function grisu_sig(x::Real, n::Integer)
grisu(float64(x), PRECISION, int32(n))
end
-function _show(io, x::Float, mode::Int32, n::Int)
+function _show(io, x::FloatingPoint, mode::Int32, n::Int)
if isnan(x); return write(io, "NaN"); end
if isinf(x); return write(io, x < 0 ? "-Inf" : "Inf"); end
@grisu_ccall x mode n
@@ -101,7 +101,7 @@ end
show(io, x::Float64) = _show(io, x, SHORTEST, 0)
show(io, x::Float32) = _show(io, x, SHORTEST_SINGLE, 0)
-showcompact(io, x::Float) = _show(io, x, PRECISION, 6)
+showcompact(io, x::FloatingPoint) = _show(io, x, PRECISION, 6)
# normal:
# 0 < pt < len ####.#### len+1
@@ -112,7 +112,7 @@ showcompact(io, x::Float) = _show(io, x, PRECISION, 6)
# pt <= 0 ########e-### len+k+2
# 0 < pt ########e### len+k+1
-function _print_shortest(io, x::Float, dot::Bool, mode::Int32)
+function _print_shortest(io, x::FloatingPoint, dot::Bool, mode::Int32)
if isnan(x); return write(io, "NaN"); end
if isinf(x); return write(io, x < 0 ? "-Inf" : "Inf"); end
@grisu_ccall x mode 0
@@ -158,7 +158,7 @@ end
print_shortest(io, x::Float64, dot::Bool) = _print_shortest(io, x, dot, SHORTEST)
print_shortest(io, x::Float32, dot::Bool) = _print_shortest(io, x, dot, SHORTEST_SINGLE)
-print_shortest(io, x::Union(Float,Integer)) = print_shortest(io, float(x), false)
+print_shortest(io, x::Union(FloatingPoint,Integer)) = print_shortest(io, float(x), false)
end # module
import Base.Grisu.print_shortest
View
4 base/int.jl
@@ -571,14 +571,14 @@ sizeof(::Type{Uint128}) = 16
# requires int arithmetic defined, for the loops to work
for f in (:int, :int8, :int16, :int32, :signed, :integer)
- @eval ($f)(x::Float) = ($f)(iround(x))
+ @eval ($f)(x::FloatingPoint) = ($f)(iround(x))
end
for (f,t) in ((:uint8,:Uint8), (:uint16,:Uint16), (:uint32,:Uint32),
(:int64,:Int64), (:uint64,:Uint64),
(:int128,:Int128), (:uint128,:Uint128),
(:unsigned,:Uint), (:uint,:Uint))
- @eval ($f)(x::Float) = iround($t,x)
+ @eval ($f)(x::FloatingPoint) = iround($t,x)
end
## wide multiplication, Int128 multiply and divide ##
View
2 base/linalg_dense.jl
@@ -1,6 +1,6 @@
## linalg_dense.jl: Basic Linear Algebra functions for dense representations ##
#
-# note that many functions have specific versions for Float/Complex arguments
+# note that many functions have specific versions for FloatingPoint/Complex arguments
# which use BLAS instead
Ac_mul_B(x::Vector, y::Vector) = [dot(x, y)]
View
8 base/printf.jl
@@ -601,7 +601,7 @@ _int_dec(x::Real) = _int_dec(float(x))
_int_hex(x::Real) = _int_hex(integer(x)) # TODO: real float decoding.
_int_HEX(x::Real) = _int_HEX(integer(x)) # TODO: real float decoding.
-function _int_dec(x::Float)
+function _int_dec(x::FloatingPoint)
if x == 0.0
NEG[1] = false
POINT[1] = 1
@@ -630,7 +630,7 @@ end
_fix_dec(x::Integer, n::Int) = (_int_dec(x); LEN[1]=POINT[1])
_fix_dec(x::Real, n::Int) = _fix_dec(float(x),n)
-function _fix_dec(x::Float, n::Int)
+function _fix_dec(x::FloatingPoint, n::Int)
if n > BUFLEN-1; n = BUFLEN-1; end
@grisu_ccall x Grisu.FIXED n
if LEN[1] == 0
@@ -680,7 +680,7 @@ end
_ini_dec(x::Integer, n::Int) = (@_handle_negative; _ini_dec(unsigned(x),n))
_ini_dec(x::Real, n::Int) = _ini_dec(float(x),n)
-function _ini_dec(x::Float, n::Int)
+function _ini_dec(x::FloatingPoint, n::Int)
if x == 0.0
POINT[1] = 1
NEG[1] = signbit(x)
@@ -742,7 +742,7 @@ end
_sig_dec(x::Integer, n::Int) = (@_handle_negative; _sig_dec(unsigned(x),n))
_sig_dec(x::Real, n::Int) = _sig_dec(float(x),n)
-function _sig_dec(x::Float, n::Int)
+function _sig_dec(x::FloatingPoint, n::Int)
@grisu_ccall x Grisu.PRECISION n
if x == 0.0; return; end
while DIGITS[n] == '0'
View
8 base/rational.jl
@@ -37,7 +37,7 @@ end
convert{T<:Integer}(::Type{Rational{T}}, x::Rational) = Rational(convert(T,x.num),convert(T,x.den))
convert{T<:Integer}(::Type{Rational{T}}, x::Integer) = Rational(convert(T,x), convert(T,1))
-function convert{T<:Integer}(::Type{Rational{T}}, x::Float, tol::Real)
+function convert{T<:Integer}(::Type{Rational{T}}, x::FloatingPoint, tol::Real)
if isnan(x); return zero(T)//zero(T); end
if x < typemin(T); return -one(T)//zero(T); end
if typemax(T) < x; return one(T)//zero(T); end
@@ -53,15 +53,15 @@ function convert{T<:Integer}(::Type{Rational{T}}, x::Float, tol::Real)
y = 1/y
end
end
-convert{T<:Integer}(rt::Type{Rational{T}}, x::Float) = convert(rt,x,0)
+convert{T<:Integer}(rt::Type{Rational{T}}, x::FloatingPoint) = convert(rt,x,0)
convert(::Type{Bool}, x::Rational) = (x!=0) # to resolve ambiguity
convert{T<:Rational}(::Type{T}, x::Rational) = x
convert{T<:Real}(::Type{T}, x::Rational) = convert(T, x.num/x.den)
promote_rule{T<:Integer}(::Type{Rational{T}}, ::Type{T}) = Rational{T}
promote_rule{T<:Integer,S<:Integer}(::Type{Rational{T}}, ::Type{S}) = Rational{promote_type(T,S)}
promote_rule{T<:Integer,S<:Integer}(::Type{Rational{T}}, ::Type{Rational{S}}) = Rational{promote_type(T,S)}
-promote_rule{T<:Integer,S<:Float}(::Type{Rational{T}}, ::Type{S}) = promote_type(T,S)
+promote_rule{T<:Integer,S<:FloatingPoint}(::Type{Rational{T}}, ::Type{S}) = promote_type(T,S)
num(x::Integer) = x
den(x::Integer) = one(x)
@@ -104,7 +104,7 @@ hash(x::Rational) = integer_valued(x) ? hash(x.num) :
==(x::Rational, y::Number ) = x.num == x.den*y
==(x::Number , y::Rational) = y == x
-==(x::Rational, y::Float ) = x.den==0 ? oftype(y,x)==y : x.num == x.den*y
+==(x::Rational, y::FloatingPoint ) = x.den==0 ? oftype(y,x)==y : x.num == x.den*y
< (x::Rational, y::Rational) = x.den == y.den ? x.num < y.num : x.num*y.den < x.den*y.num
< (x::Rational, y::Real ) = x.num < x.den*y
View
4 base/sort.jl
@@ -208,7 +208,7 @@ sort_by!{T}(by::Function, a::AbstractVector{T}) =
@_jl_sort_functions "_fp_neg" :(_jl_fp_neg_lt($a,$b))
# push NaNs to the end of a, returning # of non-NaNs
-function _jl_nans_to_end{T<:Float}(a::AbstractVector{T})
+function _jl_nans_to_end{T<:FloatingPoint}(a::AbstractVector{T})
n = length(a)
if n <= 1
return n
@@ -234,7 +234,7 @@ function _jl_nans_to_end{T<:Float}(a::AbstractVector{T})
return n-nnan
end
-function sort!{T<:Float}(a::AbstractVector{T})
+function sort!{T<:FloatingPoint}(a::AbstractVector{T})
n = _jl_nans_to_end(a)
i, j = 1, n
while true
View
6 doc/helpdb.jl
@@ -1003,19 +1003,19 @@ collection[key...] = value
"),
-(E"Mathematical Functions",E"ceil",E"ceil(x) -> Float
+(E"Mathematical Functions",E"ceil",E"ceil(x) -> FloatingPoint
Returns the nearest integer not less than 'x'.
"),
-(E"Mathematical Functions",E"floor",E"floor(x) -> Float
+(E"Mathematical Functions",E"floor",E"floor(x) -> FloatingPoint
Returns the nearest integer not greater than 'x'.
"),
-(E"Mathematical Functions",E"trunc",E"trunc(x) -> Float
+(E"Mathematical Functions",E"trunc",E"trunc(x) -> FloatingPoint
Returns the nearest integer not greater in magnitude than 'x'.
View
14 doc/manual/conversion-and-promotion.rst
@@ -84,7 +84,7 @@ action:
julia> typeof(ans)
Uint8
- julia> convert(Float, x)
+ julia> convert(FloatingPoint, x)
12.0
julia> typeof(ans)
@@ -96,8 +96,8 @@ requested conversion:
::
- julia> convert(Float, "foo")
- no method convert(Type{Float},ASCIIString)
+ julia> convert(FloatingPoint, "foo")
+ no method convert(Type{FloatingPoint},ASCIIString)
Some languages consider parsing strings as numbers or formatting
numbers as strings to be conversions (many dynamic languages will even
@@ -153,7 +153,7 @@ right after the declaration of the type and its constructors:
convert{T<:Int}(::Type{Rational{T}}, x::Rational) = Rational(convert(T,x.num),convert(T,x.den))
convert{T<:Int}(::Type{Rational{T}}, x::Int) = Rational(convert(T,x), convert(T,1))
- function convert{T<:Int}(::Type{Rational{T}}, x::Float, tol::Real)
+ function convert{T<:Int}(::Type{Rational{T}}, x::FloatingPoint, tol::Real)
if isnan(x); return zero(T)//zero(T); end
if isinf(x); return sign(x)//zero(T); end
y = x
@@ -168,9 +168,9 @@ right after the declaration of the type and its constructors:
y = 1/y
end
end
- convert{T<:Int}(rt::Type{Rational{T}}, x::Float) = convert(rt,x,eps(x))
+ convert{T<:Int}(rt::Type{Rational{T}}, x::FloatingPoint) = convert(rt,x,eps(x))
- convert{T<:Float}(::Type{T}, x::Rational) = convert(T,x.num)/convert(T,x.den)
+ convert{T<:FloatingPoint}(::Type{T}, x::Rational) = convert(T,x.num)/convert(T,x.den)
convert{T<:Int}(::Type{T}, x::Rational) = div(convert(T,x.num),convert(T,x.den))
The initial four convert methods provide conversions to rational types.
@@ -357,7 +357,7 @@ mechanism with the following promotion rules:
promote_rule{T<:Int}(::Type{Rational{T}}, ::Type{T}) = Rational{T}
promote_rule{T<:Int,S<:Int}(::Type{Rational{T}}, ::Type{S}) = Rational{promote_type(T,S)}
promote_rule{T<:Int,S<:Int}(::Type{Rational{T}}, ::Type{Rational{S}}) = Rational{promote_type(T,S)}
- promote_rule{T<:Int,S<:Float}(::Type{Rational{T}}, ::Type{S}) = promote_type(T,S)
+ promote_rule{T<:Int,S<:FloatingPoint}(::Type{Rational{T}}, ::Type{S}) = promote_type(T,S)
The first rule asserts that promotion of a rational number with its own
numerator/denominator type, simply promotes to itself. The second rule
View
20 doc/manual/types.rst
@@ -115,8 +115,8 @@ exception is thrown, otherwise, the left-hand value is returned:
::
- julia> (1+2)::Float
- type error: typeassert: expected Float, got Int64
+ julia> (1+2)::FloatingPoint
+ type error: typeassert: expected FloatingPoint, got Int64
julia> (1+2)::Int
3
@@ -217,18 +217,18 @@ that make up Julia's numerical hierarchy:
abstract Number
abstract Real <: Number
- abstract Float <: Real
+ abstract FloatingPoint <: Real
abstract Integer <: Real
abstract Signed <: Integer
abstract Unsigned <: Integer
The ``Number`` type is a direct child type of ``Any``, and ``Real`` is
its child. In turn, ``Real`` has two children (it has more, but only two
are shown here; we'll get to the others later): ``Integer`` and
-``Float``, separating the world into representations of integers and
+``FloatingPoint``, separating the world into representations of integers and
representations of real numbers. Representations of real numbers
include, of course, floating-point types, but also include other types,
-such as Julia's rationals. Hence, ``Float`` is a proper subtype of
+such as Julia's rationals. Hence, ``FloatingPoint`` is a proper subtype of
``Real``, including only floating-point representations of real numbers.
Integers are further subdivided into ``Signed`` and ``Unsigned``
varieties.
@@ -244,7 +244,7 @@ subtype of its right operand:
julia> Integer <: Number
true
- julia> Integer <: Float
+ julia> Integer <: FloatingPoint
false
Since abstract types have no instantiations and serve as no more than
@@ -263,8 +263,8 @@ the standard bits types are all defined in the language itself:
::
- bitstype 32 Float32 <: Float
- bitstype 64 Float64 <: Float
+ bitstype 32 Float32 <: FloatingPoint
+ bitstype 64 Float64 <: FloatingPoint
bitstype 8 Bool <: Integer
bitstype 32 Char <: Integer
@@ -1014,7 +1014,7 @@ true or false:
julia> isa(1,Int)
true
- julia> isa(1,Float)
+ julia> isa(1,FloatingPoint)
false
The ``typeof`` function, already used throughout the manual in examples,
@@ -1100,7 +1100,7 @@ only kinds of types that the ``super`` function applies to:
::
julia> super(Float64)
- Float
+ FloatingPoint
julia> super(Number)
Any
View
6 doc/stdlib/base.rst
@@ -704,15 +704,15 @@ Mathematical Functions
Accurately compute ``exp(x)-1``
-.. function:: ceil(x) -> Float
+.. function:: ceil(x) -> FloatingPoint
Returns the nearest integer not less than ``x``.
-.. function:: floor(x) -> Float
+.. function:: floor(x) -> FloatingPoint
Returns the nearest integer not greater than ``x``.
-.. function:: trunc(x) -> Float
+.. function:: trunc(x) -> FloatingPoint
Returns the nearest integer not greater in magnitude than ``x``.
View
2 extras/bigfloat.jl
@@ -2,7 +2,7 @@ _jl_libgmp_wrapper = dlopen("libgmp_wrapper")
require("bigint.jl")
-type BigFloat <: Float
+type BigFloat <: FloatingPoint
mpf::Ptr{Void}
function BigFloat(x::String)
View
2 extras/fitsio.jl
@@ -22,7 +22,7 @@ fits_assert_ok(f::FITSFile) = fits_assert_ok(f.status)
# constants
_cfitsio_bitpix{T<:Integer}(::Type{T}) = int32(8*sizeof(T))
-_cfitsio_bitpix{T<:Float}(::Type{T}) = int32(-8*sizeof(T))
+_cfitsio_bitpix{T<:FloatingPoint}(::Type{T}) = int32(-8*sizeof(T))
_cfitsio_datatype(::Type{Uint8}) = int32(11)
_cfitsio_datatype(::Type{Int8}) = int32(12)
View
6 extras/image.jl
@@ -423,7 +423,7 @@ function write_bitmap_data(s, img)
else
error("unsupported array dimensions")
end
- elseif eltype(img) <: Float
+ elseif eltype(img) <: FloatingPoint
# prevent overflow
a = copy(img)
a[img .> 1] = 1
@@ -730,7 +730,7 @@ end
imfilter(img, filter) = imfilter(img, filter, "replicate", 0)
imfilter(img, filter, border) = imfilter(img, filter, border, 0)
-function imlineardiffusion{T}(img::Array{T,2}, dt::Float, iterations::Integer)
+function imlineardiffusion{T}(img::Array{T,2}, dt::FloatingPoint, iterations::Integer)
u = img
f = imlaplacian()
for i = dt:dt:dt*iterations
@@ -739,7 +739,7 @@ function imlineardiffusion{T}(img::Array{T,2}, dt::Float, iterations::Integer)
u
end
-function imthresh{T}(img::Array{T,2}, threshold::Float)
+function imthresh{T}(img::Array{T,2}, threshold::FloatingPoint)
if !(0.0 <= threshold <= 1.0)
error("threshold must be between 0 and 1")
end
View
8 extras/nearequal.jl
@@ -25,12 +25,12 @@ isapproxn(x, y, rtol, atol) = isapprox(x, y, rtol, atol) || (isnan(x) && isnan(y
for fun in (:isapprox, :isapproxn)
@eval begin
- function ($fun){T1<:Float, T2<:Float}(x::T1, y::T2)
+ function ($fun){T1<:FloatingPoint, T2<:FloatingPoint}(x::T1, y::T2)
tol = max(eps(T1), eps(T2))
($fun)(x, y, tol^(1/3), sqrt(tol))
end
- ($fun){T1<:Integer, T2<:Float}(x::T1, y::T2) = ($fun)(float(x), y)
- ($fun){T1<:Float, T2<:Integer}(x::T1, y::T2) = ($fun)(x, float(y))
+ ($fun){T1<:Integer, T2<:FloatingPoint}(x::T1, y::T2) = ($fun)(float(x), y)
+ ($fun){T1<:FloatingPoint, T2<:Integer}(x::T1, y::T2) = ($fun)(x, float(y))
($fun)(X::AbstractArray, y::Number) = map(x -> ($fun)(x, y), X)
($fun)(x::Number, Y::AbstractArray) = map(y -> ($fun)(y, x), Y)
@@ -50,7 +50,7 @@ end
# For integers, isapprox() is just isequal() unless you specify nondefault tolerances.
isapprox{T1<:Integer, T2<:Integer}(x::T1, y::T2) = isequal(x, y)
-#isapproxn() doesn't apply to two Integer types, since typeof(NaN)<:Float
+#isapproxn() doesn't apply to two Integer types, since typeof(NaN)<:FloatingPoint
#ISEQUALN Check for equality, treating NaNs as mutually equal.
# ISEQUALN(x, y) gives the same results as ISEQUAL(x, y), unless both x and y are NaN
View
8 extras/sparse.jl
@@ -360,7 +360,7 @@ function findn_nzs{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti})
return (I, J, V)
end
-function sprand_rng(m::Int, n::Int, density::Float, rng::Function)
+function sprand_rng(m::Int, n::Int, density::FloatingPoint, rng::Function)
# TODO: Need to be able to generate int32 random integer arrays.
# That will save extra memory utilization in the int32() calls.
numnz = int(m*n*density)
@@ -372,8 +372,8 @@ function sprand_rng(m::Int, n::Int, density::Float, rng::Function)
return S
end
-sprand(m::Int, n::Int, density::Float) = sprand_rng (m,n,density,rand)
-sprandn(m::Int, n::Int, density::Float) = sprand_rng (m,n,density,randn)
+sprand(m::Int, n::Int, density::FloatingPoint) = sprand_rng (m,n,density,rand)
+sprandn(m::Int, n::Int, density::FloatingPoint) = sprand_rng (m,n,density,randn)
#sprandi(m,n,density) = sprand_rng (m,n,density,randi)
spones{T}(S::SparseMatrixCSC{T}) =
@@ -1024,7 +1024,7 @@ function assign(S::SparseAccumulator, v, i::Integer)
return S
end
-type Tridiagonal{T<:Float} <: AbstractMatrix{T}
+type Tridiagonal{T<:FloatingPoint} <: AbstractMatrix{T}
a::Vector{T} # sub-diagonal
b::Vector{T} # diagonal
c::Vector{T} # sup-diagonal
View
6 extras/specfun.jl
@@ -51,7 +51,7 @@ airyaiprime(z) = airy(1,z)
airybi(z) = airy(2,z)
airybiprime(z) = airy(3,z)
-airy(k, x::Float) = oftype(x, real(airy(k, complex(x))))
+airy(k, x::FloatingPoint) = oftype(x, real(airy(k, complex(x))))
airy(k, x::Real) = airy(k, float(x))
airy(k, z::Complex64) = complex64(airy(k, complex128(z)))
airy(k, z::Complex) = airy(k, complex128(z))
@@ -140,7 +140,7 @@ let
end
end
- function besselj(nu::Integer, x::Float)
+ function besselj(nu::Integer, x::FloatingPoint)
if x == 0
return (nu == 0) ? one(x) : zero(x)
end
@@ -177,7 +177,7 @@ besseli(nu::Real, z::Complex64) = complex64(bessely(float64(nu), complex128(z)))
besseli(nu::Real, z::Complex) = besseli(float64(nu), complex128(z))
besseli(nu::Real, x::Real) = besseli(float64(nu), complex128(x))
-function besselj(nu::Float, x::Float)
+function besselj(nu::FloatingPoint, x::FloatingPoint)
ans = besselj(float64(nu), complex128(x))
(x > 0) ? oftype(x, real(ans)) : ans
end
View
2 extras/test.jl
@@ -9,7 +9,7 @@ type TestResult
group
expr_str::String
succeed::Bool # good outcome == true
- elapsed::Float
+ elapsed::FloatingPoint
exception_thrown::Exception
operation
arg1
View
2 extras/winston.jl
@@ -541,7 +541,7 @@ end
# =============================================================================
abstract RenderObject
-typealias RenderStyle Dict{String,Union(Integer,Float,String)}
+typealias RenderStyle Dict{String,Union(Integer,FloatingPoint,String)}
function kw_init( self::RenderObject, args...)
for (k,v) in kw_defaults(self)
View
2 test/core.jl
@@ -349,7 +349,7 @@ end
# issue #1153
type SI{m, s, kg}
- value::Float
+ value::FloatingPoint
end
*{m1, m2, s1, s2, kg1, kg2}(x::SI{m1, s1, kg1}, y::SI{m2, s2, kg2}) = SI{m1 + m2, s1 + s2, kg1 + kg2}(x.value * y.value)
View
2 test/glpk.jl
@@ -25,7 +25,7 @@ glp_set_col_bnds(lp, 3, GLP_LO, 0.0, 0.0)
glp_set_obj_coef(lp, 3, 4.0)
ia = zeros(Int, 9)
ja = zeros(Int, 9)
-ar = zeros(Float, 9)
+ar = zeros(FloatingPoint, 9)
ia[1] = 1; ja[1] = 1; ar[1] = 1.0
ia[2] = 1; ja[2] = 2; ar[2] = 1.0
ia[3] = 1; ja[3] = 3; ar[3] = 1.0

2 comments on commit cfaf2d2

@ViralBShah
The Julia Language member

Why did we rename Float to FloatingPoint? It just seems more verbose to me. What do we gain?

@ViralBShah
The Julia Language member

Ok, I see the discussion here.

#1221

Please sign in to comment.
Something went wrong with that request. Please try again.