11import Base. FastMath
2- import Core. Intrinsics:
3- sqrt_llvm,
4- neg_float_fast,
5- add_float_fast,
6- sub_float_fast,
7- mul_float_fast,
8- div_float_fast,
9- rem_float_fast,
10- eq_float_fast,
11- ne_float_fast,
12- lt_float_fast,
13- le_float_fast
142
153import Base. FastMath: @fastmath ,
164 FloatTypes,
@@ -40,27 +28,27 @@ import Base.FastMath: @fastmath,
4028 angle_fast,
4129 fast_op
4230
43- sub_fast (x:: Quantity{T} ) where {T <: FloatTypes } = typeof (x)(neg_float_fast (x. val))
31+ sub_fast (x:: Quantity{T} ) where {T <: FloatTypes } = typeof (x)(sub_fast (x. val))
4432
4533add_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
46- Quantity {T,D,U} (add_float_fast (x. val, y. val))
34+ Quantity {T,D,U} (add_fast (x. val, y. val))
4735
4836sub_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
49- Quantity {T,D,U} (sub_float_fast (x. val, y. val))
37+ Quantity {T,D,U} (sub_fast (x. val, y. val))
5038
5139function mul_fast (x:: Quantity{T} , y:: Quantity{T} ) where {T <: FloatTypes }
5240 D = dimension (x) * dimension (y)
5341 U = typeof (unit (x) * unit (y))
54- Quantity {T,D,U} (mul_float_fast (x. val, y. val))
42+ Quantity {T,D,U} (mul_fast (x. val, y. val))
5543end
5644function div_fast (x:: Quantity{T} , y:: Quantity{T} ) where {T <: FloatTypes }
5745 D = dimension (x) / dimension (y)
5846 U = typeof (unit (x) / unit (y))
59- Quantity {T,D,U} (div_float_fast (x. val, y. val))
47+ Quantity {T,D,U} (div_fast (x. val, y. val))
6048end
6149
6250rem_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
63- Quantity {T,D,U} (rem_float_fast (x. val, y. val))
51+ Quantity {T,D,U} (rem_fast (x. val, y. val))
6452
6553add_fast (x:: Quantity{T} , y:: Quantity{T} , z:: Quantity{T} , t:: Quantity{T} ...) where {T <: FloatTypes } =
6654 add_fast (add_fast (add_fast (x, y), z), t... )
@@ -73,13 +61,13 @@ mul_fast(x::Quantity{T}, y::Quantity{T}, z::Quantity{T}, t::Quantity{T}...) wher
7361end
7462
7563eq_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
76- eq_float_fast (x. val,y. val)
64+ eq_fast (x. val,y. val)
7765ne_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
78- ne_float_fast (x. val,y. val)
66+ ne_fast (x. val,y. val)
7967lt_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
80- lt_float_fast (x. val,y. val)
68+ lt_fast (x. val,y. val)
8169le_fast (x:: Quantity{T,D,U} , y:: Quantity{T,D,U} ) where {T <: FloatTypes ,D,U} =
82- le_float_fast (x. val,y. val)
70+ le_fast (x. val,y. val)
8371
8472@fastmath begin
8573 abs_fast (x:: Quantity{T} ) where {T <: ComplexTypes } = hypot (real (x), imag (x))
@@ -163,7 +151,7 @@ pow_fast(x::Quantity, y::Integer) = x^y
163151pow_fast (x:: Quantity , y:: Rational ) = x^ y
164152
165153sqrt_fast (x:: Quantity{T} ) where {T <: FloatTypes } =
166- Quantity (sqrt_llvm (x. val), sqrt (unit (x)))
154+ Quantity (sqrt_fast (x. val), sqrt (unit (x)))
167155
168156for f in (:cos , :sin , :tan )
169157 f_fast = fast_op[f]
0 commit comments