Skip to content

Truncate ​

The integer part of x, rounding toward 0.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaTruncationWolfram LanguageIntegerPart✓
Truncate(x)the integer part of x, rounded toward 0.
Typed signatures
TypePackageApplies
(x: real | signed_infinity | ~oo, step: real?) -> real | signed_infinity | ~oocompute-enginealways

Domain: Arithmetic

Details
  • Rounds toward 0: Floor for x≥0x \ge 0 and Ceil for x<0x < 0, so Truncate⁡(−3.7)=−3\operatorname{Truncate}(-3.7) = -3.
  • An exact rational is truncated exactly, however large: Truncate⁡((25!−1)/24!)=24\operatorname{Truncate}\big((25! - 1)/24!\big) = 24.

Examples

2 more kept as data, checked against the oracles
Basic #
live ↗
InTruncate(72)\mathrm{Truncate}(\frac{7}{2})Out33
live ↗
InTruncate(−72)\mathrm{Truncate}(-\frac{7}{2})Out−3-3
About
Examples4
Checked againstWolfram Language 4 agree
CrosswalkWikipediaWolfram Language

Implementation

mappedwolframpackages/oracle/src/mappings.ts

See also: Floor, Ceil, Round