top | item 19523480

(no title)

oconnor0 | 7 years ago

> and not so good at floating point computations

What does this mean? I was under the impression the OCaml compiler did a decent number of floating point specific optimizations, like unboxed arrays and what not.

discuss

order

noir_lord|7 years ago

Surprised me as well janestreet are a well known user of ocaml and I can't imagine they don't use a lot of floats.

pjmlp|7 years ago

I guess it is the typical complain about using separate operators for ints and floats.

It never bothered me in Caml Light, let alone when Objective Caml was introduced.

andrepd|7 years ago

You can write floating point operators in several different ways. You can write with the normal floating point operators

    x *. y +. z
or, since `Float.(+) = (+.)`, `Float.() = (.)`, etc,

    let open Float in
    x * y + z
or simply

    Float.(x * y + z)

oconnor0|7 years ago

Ah, maybe, perhaps I am in the minority that liked the different operators for ints and floats. :D

rixed|7 years ago

Symbols (variants with our without parameters) and integers are unboxed, while floats are not (but in a few specific cases such as arrays of floats, and iiuc that's an inelegant special case on its way out, as it prevents other optimisations).