Function Entry: RTOS

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: RTOS

Name

rtos

Class

Conversion Function

Syntax

(rtos number [mode [precision]])

Arguments and Values

  • number: number
  • mode: optional conversion mode
  • precision: optional precision

Description

Converts a real or number to a string according to AutoCAD formatting conventions.

Return Values

String.

Side Effects

None.

Affected By

  • numeric formatting settings
  • conversion mode and precision

Compatibility

This function is part of the language/host formatting boundary, not purely a generic printer primitive.

Notes

  • Autodesk documents the accepted mode values as the linear-unit formats corresponding to LUNITS:
    • 1 scientific
    • 2 decimal
    • 3 engineering
    • 4 architectural
    • 5 fractional
  • If mode and precision are omitted, Autodesk documents that rtos uses the current LUNITS and LUPREC settings.
  • Autodesk documents that the resulting string is affected by UNITMODE for engineering, architectural, and fractional output, and by DIMZIN for zero suppression.
  • Locale insensitivity (normative). rtos always uses . as the decimal separator regardless of the host's `LCNUMERIC` / LANG / `LCALL` environment, regardless of the OS-level locale, and regardless of the DIMDSEP system variable. DIMDSEP controls only the dimension-text renderer (see § System Variable Entry: DIMDSEP), not the AutoLISP numeric printer. The complementary (atof) rejects locale- comma input the same way — see the (atof "3,5") -> 3.0 probe in § atof. clautolisp matches this contract end-to-end: the value printer (autolisp-value->string, princ / prin1 / vl-*-to-string) is also locale-insensitive — (vl-princ-to-string 3.14) is "3.14" on every locale, every host. User code that wants a comma-separator UI does the substitution itself; the AutoLISP runtime stays in .-land so that (atof (rtos n)) round-trips on every machine.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: presumed compatible (no contradicting page found).
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.