Hacker News new | ask | show | jobs
by tkoolen 2677 days ago
I actually can't think of a single language that doesn't allow you to multiply an integer and a floating point value, yielding a floating point result.
5 comments

Rust.

In Rust, all type coercion must be explicit, you can't even add different integer types:

5i64 + 5i32 // WONT compile

5i64 + 5i32 as i64 // will work

OCaml has distinct multiplication operators for ints and floats. Haskell's multiplication operator requires its arguments to be of the same numeric type, and returns a product of the same type. That's two, off the top of my head...
JavaScript? 23n + 5 causes a TypeError.
Go ?
Ada?