log10

Returns the base 10 logarithm of the receiver.

import { Arith } from "@teakit/arith";

Arith.from("1000").log10().toString(); // "3"
Arith.from("1").log10().toString(); // "0"
Arith.from("0.01").log10().toString(); // "-2"

// Non-power-of-ten inputs are rounded by the constructor precision settings.
Arith.from("2").log10().toString(); // "0.30102999566398119521"

// Invalid logarithm domains return NaN.
Arith.from("-1").log10().toString(); // "NaN"

// Use the static helper when no method chain is needed.
Arith.log10("0.01").toString(); // "-2"

API Reference

Signature

log10(): ArithInstance;

Parameters

ParameterTypeRequiredNotes
None--This method does not take parameters.

Returns

Returns a new Arith instance. The receiver is not modified.

Throws

  • Does not take user arguments; no argument validation is performed.

Agent Contract

FieldValue
Kindinstance method and static helper
Canonical namelog10
AliasesNone
Mutates receiverNo
ReturnsArithInstance
Accepts (string, base) overloadNo
Configuration dependenciesDECIMAL_PLACES, ROUNDING_MODE
Related methodslog, log2

Agent Notes

  • Use log10() for base 10; do not rely on log() for base 10.
  • Do not generate ln.
  • Treat Arith instances as immutable.