Ambrus asked: > Could you tell me what the best way to do this calculation correctly is? > d0=: >:@<[EMAIL PROTECTED] NB. Length to represent y in base x
I responded: > The fix for this problem is: > d0m=: >:@(<.!.0)@^. Because of: http://www.jsoftware.com/help/dictionary/dictg.htm verbs like these will also work: d0f0=: 1 + <[EMAIL PROTECTED]&x: d0f1=: 1 + (<[EMAIL PROTECTED] x:) eg: 10 d0f0 999999999999 12 Note that you cannot use the original >:@<[EMAIL PROTECTED] formulation, because that is equivalent to (>:@<.)@^. and section G only supports verbs of the form [EMAIL PROTECTED] with f primitive*. The downside of this approach is that if your data isn't already extended or rational, you can have precision problems converting it, and and you're back to square one. -Dan * Actually f@:^. is also supported, though that's undocumented: http://www.jsoftware.com/pipermail/general/2006-December/028251.html -- View this message in context: http://www.nabble.com/Number-of-digits-in-a-number-tf4898850s24193.html#a14033511 Sent from the J Programming mailing list archive at Nabble.com. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
