"Best practice" for constant expressions (1/2 vs. 1.0/2.0)?

Pretty easy to do some tests and find out:

julia> f1(x) = 1/2 * sin(2/3 * x)
f1 (generic function with 1 method)

julia> f2(x) = 1.0/2.0 * sin(2.0/3.0 * x)
f2 (generic function with 1 method)

julia> f3(x) = 1//2 * sin(2//3 * x)
f3 (generic function with 1 method)

julia> using BenchmarkTools

julia> @btime f1(0.5);
  1.989 ns (0 allocations: 0 bytes)

julia> @btime f2(0.5);
  2.288 ns (0 allocations: 0 bytes)

julia> @btime f3(0.5);
  57.565 ns (0 allocations: 0 bytes)

julia> x = rand(10000);

julia> @btime f1.($x);
  89.042 μs (2 allocations: 78.20 KiB)

julia> @btime f2.($x);
  88.785 μs (2 allocations: 78.20 KiB)

julia> @btime f3.($x);
  507.082 μs (2 allocations: 78.20 KiB)

So it looks like the only hard-and-fast rule is to not use rational numbers. That makes sense because there aren’t hardware instructions for multiplying rationals.