addaptic

Reference Logarithms

lz_log_b

The logarithm to the number's own base.

long lz_log_b( CLZNumber* leftOperand, CLZNumber* targetNumber = nullptr );

ln x ÷ ln b, where b is the operand's own base: log10 for a decimal number, log2 for a binary one. It is worked wider and rounded once, and a logarithm that is a fraction is decided exactly. The answer is in the operand's base, so log2 8 is written 11.

Examples

CallAnswer
lz_log_b( 1000 )3.000000000000000000000000000000000000
lz_log_b( 2 )0.301029995663981195213738894724493027
lz_log_b( 8 ) base 211.000000000000000000000000000000000000 base 2
lz_log_b( 0.5 ) base 16−0.400000000000000000000000000000000000 base 16

Each answer is what Addaptic printed for the call, at 36 places unless a setting is shown.

Returns

kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.

See also

  • lz_log_e The natural logarithm.
  • lz_log_n The logarithm of the right number to the base of the left.
  • lz_exp_b The number's own base raised to the power of the number.
  • lzc_log_b The principal logarithm to the base the number is written in.