简体   繁体   中英

OCaml - Functions on floats are not working

I'm writing some simple operations on floating-point numbers. But when I use some of the built-in float functions like

floor 3.2;;

I get this error:

This expression has type float but an expression was expected of type
         [ `Deprecated_use__Float__round_down ]

What is going wrong here?

I'm on version 4.02.1

This is a Core "replacement" for the stdlib function floor . Opening Core shadows the usual floor with a function that has a cute type that that is meant to suggest that the user should pick another function.

You can either follow the suggestion and use Float.round_down or get your hands on the original binding and use that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM