乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: samifox

[编程交流] 将getint()整数存储到l

[复制链接]
pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:12:10 | 显示全部楼层
 
太好了,我现在可能不知道这意味着什么,但我会的。谢谢李,谢谢你的教训。
 
干杯
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:17:36 | 显示全部楼层
 
不客气。
 
关于对数的信息太多了,无法在论坛帖子中解释,但如果你有兴趣了解更多,可汗学院有一整节关于这个主题:
 
https://www.khanacademy.org/math/algebra/logarithms-tutorial
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:18:55 | 显示全部楼层
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:25:51 | 显示全部楼层
 

 
Here is another way to determine the number of digits:
  1. (defun c:5dig ( / d n )   (while       (and           (setq n (getreal "\nEnter a 5-digit number: "))           (/= 5 (setq d (digits (setq n (fix n)))))       )       (princ (strcat "\n" (itoa n) " has " (itoa d) " digits."))   )   n)(defun digits ( n )   (1+ (fix (/ (log n) (log 10)))))
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:28:28 | 显示全部楼层
 
Very nice Lee   I knew there's a math solution to that besides using the usual operators.
 
Can you explain the function log in a way everyone else can understand it?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:30:31 | 显示全部楼层
 
Cheers pBe
 
 
How long have you got?
 
To briefly explain, the AutoLISP log function returns the natural logarithm (usually written 'ln') of the supplied number, that is, the logarithm with base e (2.718...), or the inverse exponential function.
 
For logarithms in general we have:
  1. log_a(b) = x  =>  a^x = b
That is, the logarithm base a of b results in a number such that a raised to that number will equal b.
 
In my function, I am calculating a value x such that:
  1. n = 10^x
Using a logarithm of base 10 this can be easily calculated (since log_x(x) = 1):
  1. n = 10^xlog_10(n) = log_10(10^x)log_10(n) = x(log_10(10))=> x = log_10(n)
However, since we only have access to the natural logarithm function (log), we must proceed in the following way:
  1. n = 10^xlog(n) = log(10^x)log(n) = x(log(10))=> x = log(n)/log(10)
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:33:13 | 显示全部楼层
 
Excellent, I may not know what that means now but in time I will.   Thank you Lee, appreciate the lesson.
 
Cheers
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:37:40 | 显示全部楼层
 
You're very welcome.
 
There's far too much information on logarithms than could be explained in a forum post, but if you are interested in learning more, the Khan Academy have a whole section on the topic:
 
https://www.khanacademy.org/math/algebra/logarithms-tutorial
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 15:37 , Processed in 0.947240 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表