package np

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `Float
]
type t = [ `Float | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?x:Py.Object.t -> unit -> t

Convert a string or number to a floating point number, if possible.

val as_integer_ratio : [> tag ] Obj.t -> Py.Object.t

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original float and with a positive denominator.

Raise OverflowError on infinities and a ValueError on NaNs.

>>> (10.0).as_integer_ratio() (10, 1) >>> (0.0).as_integer_ratio() (0, 1) >>> (-.25).as_integer_ratio() (-1, 4)

val conjugate : [> tag ] Obj.t -> Py.Object.t

Return self, the complex conjugate of any float.

val fromhex : string:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Create a floating-point number from a hexadecimal string.

>>> float.fromhex('0x1.ffffp10') 2047.984375 >>> float.fromhex('-0x1p-1074') -5e-324

val hex : [> tag ] Obj.t -> Py.Object.t

Return a hexadecimal representation of a floating-point number.

>>> (-0.1).hex() '-0x1.999999999999ap-4' >>> 3.14159.hex() '0x1.921f9f01b866ep+1'

val is_integer : [> tag ] Obj.t -> Py.Object.t

Return True if the float is an integer.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.