Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: quanta.id - Function Up: quanta - Tool Previous: quanta.splitdate - Function


quanta.tos - Function



Package general
Module quanta
Tool quanta


convert quantity to string


Synopsis
tos(v, prec)


Arguments

v in value
    Allowed: quantity or string
prec in convert precision of value
    Allowed: integer
    Default: 0


Returns
string


Description
tos converts a quantity to a string with the precision defined with the setformat('prec') (which defaults to 9). If the optional prec argument is set to an integer value greater than 1, that precision is used in the conversion



Example
- print a := dq.quantity('2.56 yd/s')
[value=2.56, unit=yd/s]
- dq.tos(a)
2.56 yd/s 
- a:=dq.quantity(1/7, 'km/s')
- dq.tos(a)
0.142857143 km/s 
- dq.tos(a,2)
0.14 km/s 
- dq.tos(a,20)
0.14285714285714284921 km/s 
- dq.tos(a)   
0.142857143 km/s





next up previous contents index
Next: quanta.id - Function Up: quanta - Tool Previous: quanta.splitdate - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01