Class Lisp::Format::Directives::ExpFP
In: lib/facet/lisp-format.rb
Parent: Directive

Represents the ~E (Exponential floating-point) directive. This outputs floating point values in what is known as exponential or scientific floating point format, such as 1.0e+3 for 1000.

Methods

execute  

Public Instance methods

Outputs the argument using exponential floating-point format. The full form is

  ~w,d,e,k,overflowchar,padchar,exponentchar@E

with the following interpretations

w (nil)
if non-nil, the output will be exactly w characters long,
d (nil)
if non-nil, this is the number of digits output after the decimal point (.),
e (nil)
if non-nil, the exponent part of the output will be exactly e characters long,
k (1)
scaling factor - the number is first scaled using this value,
overflowchar (nil)
if non-nil, this character is used when this directive would produce output longer than that specified with the w directive,
padchar (?\s)
character to pad with if w is non-nil and output isn’t wide enough yet,
exponentchar (?e)
character to use for exponent divider,
@
numbers are always output with sign prepended.

An ArgumentError is raised if the argument is not a number or a string that can be converted to a number.

[Validate]