bundles / scipy latest / scipy / io / _harwell_boeing / _fortran_format_parser / IntFormat / from_number
classmethod
scipy.io._harwell_boeing._fortran_format_parser:IntFormat.from_number
source: /scipy/io/_harwell_boeing/_fortran_format_parser.py :37
Summary
Given an integer, returns a "reasonable" IntFormat instance to represent any number between 0 and n if n > 0, -n and n if n < 0
Parameters
n: intmax number one wants to be able to represent
min: intminimum number of characters to use for the format
Returns
res: IntFormatIntFormat instance with reasonable (see Notes) computed width
Notes
Reasonable should be understood as the minimal string length necessary without losing precision. For example, IntFormat.from_number(1) will return an IntFormat instance of width 2, so that any 0 and 1 may be represented as 1-character strings without loss of information.
Aliases
-
scipy.io._harwell_boeing._fortran_format_parser.IntFormat.from_number