Why "Int()" is capitalized and "float()" is not?

Not really — parsing is not what float is for. Try parse etc.

The purpose of float in Julia is to take ensure that your values end up as floating point, usually at a point in some calculation where you are

  1. willing to accept the loss in precision implied by floating point,
  2. in exchange for implicitly assuming that the result returned by float will be a type that has all relevant arithmetic ops defined,
  3. you don’t want to bother figuring out the actual float type though, or want to keep it flexible.

This is just my reconstruction though — neither the interface nor the usage is really explained in the docs. Also, float is a bit vestigial in the sense that it operates on values, arrays, and types: in current practice, arrays would be dealt with by broadcasting, and types would get a separate function.

Cf

1 Like