log10(C) overflows for a big number, limitation or bug?

For a bignumber C below, integer arithmetic integer(log10(C))
got overflow error. The log is below. Is this a bug or limitation ?
Is there more robust alternative to log10 ?

Actually the length of C is 580 in the decimal form. It was checked by writing small codes

log10_for_bignum(X, 1):- X =< 10, !.
log10_for_bignum(X, L):- Y is X // 10,
	log10_for_bignum(Y, L0),
	L is L0+1.

Or, on Emacs, M-x count-words-region command also count the digits.

BTW, C is the number of functions from a fixed domain and range,
built in ZDD within about 1 min. On handling ZDD, such big numbers are often seen.

% ?- C = 5038769413089448373710567767119331367936629377598615497650998734811318178420694264311218409738352950873529090140861088835486216922520076233897543316922532508943862126995554582518859993068327279361932870919126951487443774282108457116814956474115106506989754788419467772228117010680770113174112176226422909724659647716291954948741293094136173874559299766993172525512214099271112659517069017015579841882837110237644522258842748418857699141298651130766650806849740257739804823830153071393357719480926442939659561583167238844654029569520603365917539901902639676415135995218611363796907
,  log10_for_bignum(C, N).
%@ ERROR: Arithmetic: evaluation error: `float_overflow'
%@ ERROR: In:
%@ ERROR:   [16] throw(error(evaluation_error(float_overflow),context(...,_366371926)))
%@ ERROR:   [14] catch(zdd:(...,...),error(evaluation_error(float_overflow),context(...,_366371982)),prolog_statistics:(...,...)) at /Users/cantor/lib/swipl/boot/init.pl:529
%@ ERROR:   [13] setup_call_catcher_cleanup(system:true,prolog_statistics:catch(...,...,...),_366372022,prolog_statistics:(_366372054=true)) at /Users/cantor/lib/swipl/boot/init.pl:610
%@ ERROR:   [11] prolog_statistics:time('<garbage_collected>') at /Users/cantor/lib/swipl/library/statistics.pl:298
%@ ERROR:    [9] toplevel_call('<garbage_collected>') at /Users/cantor/lib/swipl/boot/toplevel.pl:1113
%@ ERROR: 
%@ ERROR: Note: some frames are missing due to last-call optimization.
%@ ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
%@    Call: (15) _7652=true ? creep
%@    Exit: (15) true=true ? abort
%@ % Execution Aborte

Thanks for help.

Kuniaki Mukai

Log10 is a float function. Maybe msb can help? That is effectively floor(log2(X)) I think (it is late)

Thank you Jan,

float was out of my sight before you pointed. Yes, I have checked that msb works. For the bignumber C, arithmetic
floor(msb(C) * (log(2)/log(10))) shows 579, which is nearly equal to
that of my log10_for_bignumber.

Kuniaki Mukai