Yes, this is an expected behavior in Rust. (Other languages behave the same.) There is no workaround: 10^13 is simply unrepresentable exactly with f32. (It is representable exactly with f64, however.)
Specifically, f32 has 24 bits of precision, so the number gets rounded when it's stored in f32:
10000000000000 = 0b10010001100001001110011100101010000000000000
9999999827968 = 0b10010001100001001110011100000000000000000000
When it's printed in decimal, 9999999827968 gets rounded again to 10000000000000, because it rounds to the "simplest" decimal number that has the same representation in f32.
Note that this will print the same output:
fn main() {
let x: f32 = 9999999999999.0;
println!("{} {}", x, x as i64);
}
You can see from tweaking bits there is that the next smaller float is 9,999,998,779,392 and the next bigger one is 10,000,000,876,544, so that 9,999,999,827,968 you saw is the closest representable value to 10¹³, and thus what you get.