@@ -276,25 +276,19 @@ Base.:*(x::MyFloat64, y::Float64) = x.num * y
276276 @test uconvert (u " kOe^1000" , 1 u " kOe^1001 * Oe^-1" ) === 1000 u " kOe^1000"
277277 # Issue 753:
278278 # preserve the floating point precision of quantities
279- @test Unitful. numtype (uconvert (m, BigFloat (100 )cm)) === BigFloat
280- @test Unitful. numtype (uconvert (cm, (BigFloat (1 )π + im) * m)) === Complex{BigFloat}
281- @test Unitful. numtype (uconvert (rad, BigFloat (360 )°)) === BigFloat
282- @test Unitful. numtype (uconvert (°, (BigFloat (2 )π + im) * rad)) === Complex{BigFloat}
283- @test Unitful. numtype (uconvert (m, 100.0 cm)) === Float64
284- @test Unitful. numtype (uconvert (cm, (1.0 π + im) * m)) === ComplexF64
285- @test Unitful. numtype (uconvert (rad, 360.0 °)) === Float64
286- @test Unitful. numtype (uconvert (°, (2.0 π + im) * rad)) === ComplexF64
287- @test Unitful. numtype (uconvert (m, 100f0 cm)) === Float32
288- @test Unitful. numtype (uconvert (cm, (1f0 π + im) * m)) === ComplexF32
289- @test Unitful. numtype (uconvert (rad, 360f0 °)) === Float32
290- @test Unitful. numtype (uconvert (°, (2f0 π + im) * rad)) === ComplexF32
291- @test Unitful. numtype (uconvert (m, Float16 (100 )cm)) === Float16
292- @test Unitful. numtype (uconvert (cm, (Float16 (1 )π + im) * m)) === ComplexF16
293- @test Unitful. numtype (uconvert (rad, Float16 (360 )°)) === Float16
294- @test Unitful. numtype (uconvert (°, (Float16 (2 )π + im) * rad)) === ComplexF16
279+ for T = [Float16, Float32, Float64, BigFloat]
280+ @test Unitful. numtype (uconvert (m, T (100 )cm)) === T
281+ @test Unitful. numtype (uconvert (cm, (T (1 )π + im) * m)) === Complex{T}
282+ @test Unitful. numtype (uconvert (rad, T (360 )°)) === T
283+ @test Unitful. numtype (uconvert (°, (T (2 )π + im) * rad)) === Complex{T}
284+ @test typeof (upreferred (T (360 )°)) === T
285+ end
295286 @test uconvert (rad, NonReal (360 )°) == uconvert (rad, 360 °)
296287 @test uconvert (rad, ErrReal (360 )°) == uconvert (rad, 360 °)
297288 @test uconvert (rad, MyFloat64 (360 )°) == uconvert (rad, 360 °)
289+ @test upreferred (NonReal (360 )°) == upreferred (360 °)
290+ @test upreferred (ErrReal (360 )°) == upreferred (360 °)
291+ @test upreferred (MyFloat64 (360 )°) == upreferred (360 °)
298292 # Floating point overflow/underflow in uconvert can happen if the
299293 # conversion factor is large, because uconvert does not cancel
300294 # common basefactors (or just for really large exponents and/or
0 commit comments