next up previous contents index
Next: Variable Expansion in Input Up: Input Format Previous: Case Sensitivity   Contents   Index

Numeric Values

A number field may be an integer field (12, -44), a floating point field (3.14159), either an integer or floating point number followed by an integer exponent (1E-14, 2.65e3), or either an integer or a floating point number followed by one of the following scale factors. All of this is case-insensitive.

t 1e12
g 1e9
meg 1e6
k 1e3
mil 25.4e-6
m 1e-3
u 1e-6
n 1e-9
p 1e-12
f 1e-15

Immediately following the number and multiplier is an optional units string. The units string is composed of the separation character `#', unit specification abbreviations as listed with the settype command (see 4.7.15), and digit exponents. Giving the settype command without arguments will list the unit abbreviations known to WRspice.

The units string must start with a letter, or the separation character followed by a letter, or two separation characters followed by a letter. The string consists of a sequence of abbreviations, each optionally followed by a digit exponent. If the separation character appears within the string, the abbreviations that follow provide denominator units. The separation character in this context is logically equivalent to `/'.

The initial separation character is almost always optional. It is needed when there would be possible misinterpretation, for example 1.0F is dimensionless 1e-15, whereas 1.0#F is 1.0 farads. If the initial separation character is immedaiately followed by another separation character, then all dimensions that follow are denominator units.

Some Examples:

1.0#F#M2 1 farad per square meter
1.0##S 1 Hz
1.2uA#S 1.2 microamps per second
1.2uVS 1.2 microvolt-seconds

All multipliers and unit abbreviations are case-insensitive, but by convention we use lower case for the multiplier and upper case for the first letter of the unit abbreviation.

If the unit specifier contains an unrecognized character or abbreviation, it is ignored, and the number is dimensionless.

Internal representations of numbers carry along the unit specifier, which will appear in output, and will propagate through calculations. Thus, for example, a number specified in volts, divided by a number specified in ohms, would yield a number whose specification is amps.

It is possible to use a different character as the separator. If the variable units_catchar is set to a string consisting of a single punctuation character, then this character becomes the separation character.

next up previous contents index
Next: Variable Expansion in Input Up: Input Format Previous: Case Sensitivity   Contents   Index
Stephen R. Whiteley 2017-02-22