Math.LOG10E
Added in vES1 · Updated March 15, 2026 · Math
javascript math constants logarithm log10
Math.LOG10E is a static property of the Math object that represents the base-10 logarithm of E (Euler’s number), approximately 0.4342944819032518. It is a read-only constant; you cannot change its value.
This constant is useful when working with decimal logarithms (log base 10) or converting between natural logarithms and base-10 logarithms. While Math.log10() does the actual computation, Math.LOG10E provides the mathematical constant directly.
Syntax
Math.LOG10E
Value
Math.LOG10E; // 0.4342944819032518
Examples
Basic Usage
console.log(Math.LOG10E);
// 0.4342944819032518
Converting Between Log Bases
Math.LOG10E helps convert natural logarithms to base-10 logarithms:
function log10(x) {
return Math.log(x) * Math.LOG10E;
}
console.log(log10(10));
// 1
console.log(log10(100));
// 2
console.log(log10(1000));
// 3
Relationship with Other Constants
The constant has a direct relationship with Math.LN10:
// LOG10E = 1 / LN10
console.log(Math.LOG10E);
// 0.4342944819032518
console.log(1 / Math.LN10);
// 0.4342944819032518
Practical Calculations
// Calculate common log (base 10) from natural log
function commonLog(n) {
return Math.log(n) * Math.LOG10E;
}
console.log(commonLog(2));
// 0.3010299956639812
console.log(commonLog(1000));
// 2.9999999999999996 (approximately 3)
// Verify: log10(e) = LOG10E
console.log(Math.log10(Math.E));
// 0.4342944819032518 (approximately Math.LOG10E)
Scientific Notation Conversion
// Convert between natural log and decimal log
function scientificToDecimal(exponent) {
return exponent * Math.LOG10E;
}
console.log(scientificToDecimal(1));
// 0.4342944819032518
console.log(scientificToDecimal(2));
// 0.8685889638075036
Comparing Logarithm Bases
// Natural log vs base-10 log relationship
function compareLogs(x) {
const natural = Math.log(x);
const decimal = Math.log10(x);
const viaConstant = natural * Math.LOG10E;
return { natural, decimal, viaConstant };
}
const result = compareLogs(100);
console.log(result.natural);
// 4.605170185988092
console.log(result.decimal);
// 2
console.log(result.viaConstant);
// 2
Working with Exponents
// Convert exponent in natural base to decimal base
function convertExponent(naturalExponent) {
return naturalExponent / Math.LOG10E;
}
console.log(convertExponent(1));
// 2.302585092994046 (approximately Math.LN10)
console.log(convertExponent(2));
// 4.605170185988092 (approximately 2 * LN10)
Common Patterns
Logarithmic Identity Verification
// Verify: log10(x) = ln(x) / ln(10) = ln(x) * LOG10E
function verifyIdentity(x) {
const direct = Math.log10(x);
const viaNatural = Math.log(x) / Math.LN10;
const viaConstant = Math.log(x) * Math.LOG10E;
return { direct, viaNatural, viaConstant };
}
console.log(verifyIdentity(50));
// { direct: 1.69897, viaNatural: 1.69897, viaConstant: 1.69897 }
Creating Custom Log Functions
// Create a log function for any base
function logBase(base, x) {
return Math.log(x) / Math.log(base);
}
console.log(logBase(10, 100));
// 2
console.log(logBase(10, Math.E));
// 0.4342944819032518 (Math.LOG10E)
Why Use Math.LOG10E?
Using Math.LOG10E instead of hardcoding 0.4342944819032518 provides several advantages:
- Precision — The constant is defined to full floating-point precision by the JavaScript engine
- Readability — Code clearly expresses the mathematical concept rather than a magic number
- Standardization — Matches standard mathematical notation in formulas and textbooks
- Self-documenting — The name conveys the mathematical meaning to anyone reading the code
- Consistency — Using built-in constants ensures consistency across your codebase
See Also
- Math.LN10 — the natural logarithm of 10, the inverse of LOG10E
- Math.log() — returns the natural logarithm of a number
- Math.log10() — returns the base-10 logarithm of a number
- Math.LOG2E — the base-2 logarithm of E