Releases: emmt/TypeUtils.jl
v1.12.0
TypeUtils v1.12.0
Fixed
get_precisionon n-tuples yields a correct result and is inferable.
Added
get_precision()yieldsAbtractFloatinstead of throwing aMethodError.
v1.11.0
TypeUtils v1.11.0
Fixed
-
Fix tests for Julia 1.12 and above.
-
Syntax
@public a, b, cis allowed.
Merged pull requests:
- Bump actions/checkout from 4 to 5 (#3) (@dependabot[bot])
v1.10.0
TypeUtils v1.10.0
Added
-
With multiple arguments,
get_precision(x, y...)yields the best precision of all the given arguments. -
nearest(T, x)can deal with dimensionful numbers and types.
v1.9.0
TypeUtils v1.9.0
This new minor version adds methods to deal with the numerical precision of numbers and objects.
Added
-
get_precision(x)yields the numerical precision ofx. -
adapt_precision(T, x)yields a version ofxwith numerical precisionT. -
destructure(Vector, x)anddestructure(Vector{T}, x)yield a vector whiledestructure(Tuple, x)yields a tuple asdestructure(x).
v1.8.0
TypeUtils v1.8.0
Added
-
convert_eltype(T,A)forAan instance ofLinearAgebra.Factorization. -
Tests with
Aqua.jl.
Fixed
-
A few minor things detected by
Aqua.jlhave been fixed. -
Better rule for element type conversion of
AbstractUnitRangeinstances. -
Fix specialization of
Base.return_typeswhich shall return a vector of types.
v1.7.1
TypeUtils v1.7.1
Fixed
is_signed(x)is false ifxis a complex number with unsigned rational parts.
v1.7.0
TypeUtils v1.7.0
- New
is_signedmethod to infer whether a value of a given numeric type can be negated while retaining the same type. - Extend
similarfor the type of arrays returned byas_eltype.
v1.6.0
TypeUtils v1.6.0
Added
-
Macro
@assert_floating_pointto assert whether arguments or variables of a function do use floating-point for storing their value(s). -
New function
assert_floating_pointto assert whether an object does use floating-point for storing its value(s). This method is a trait: its result only depend on the type of its argument and this type may be directly specified.
Fixed
@publiccan take macro names (prefixed by@) as argument.
v1.5.1
TypeUtils v1.5.1
Changed
- Relax type restriction on
Tinconvert_bare_type(T, x),convert_real_type(T, x), andconvert_floating_point_type(T, x).
Fixed
- Fix
new_array(T)andnew_array(T,())yield a 0-dimensional array.
v1.5.0
TypeUtils v1.5.0
-
Non-exported public constructor
c = TypeUtils.Converter(f,T::Type)such thatcis callable andc(x)yieldsf(T,x)for anyx. This replaces and generalizes private typeAs. -
Methods
as(T),nearest(T),convert_bare_type(T),convert_real_type(T),convert_floating_point_type(T), andconvert_eltype(T)yield converters to typeT. -
Inference works for more than 3 arguments for
bare_type(args...),real_type(args...), andfloating_point_type(args...).