We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
约翰·哈特 (John Hart) 计算机近似 1968 年,约翰·威利 (John Wiley) 和 John Hart儿子们。
理想情况下,计算应该与运行时执行的计算精确匹配。这可能很棘手。对于许多函数来说,没有级数可以在整个域上快速收敛,因此算法将各种方法组合在一起。
此外,还有各种浮点格式。大多数平台(我认为)现在都使用 IEEE 754。当我编写编译器时,ca。 1985 年,我不得不处理跨平台浮点格式。要把它做好是非常乏味的,因为你必须将数字一点一点地拼凑在一起,确保你得到的值是在目标机器上计算的精确值。我不知道你是否需要处理这个问题。
John Hart Computer Approximations 1968 by John Wiley & Sons.
The calculations ideally should match precisely what they would if done at runtime. That can be tricky. For many functions, no series converges quickly over the full domain, so algoritms paste together various methods.
Also, there are various floating point formats. Most platforms (I think) now use IEEE 754. When I wrote a compiler ca. 1985, I had to deal with cross-platform floating point formats. It was very tedious to get it right, because you have to piece the numbers together bit by bit, being sure that you get precisely the value that would be calculated on the target machine. I don't know if you have to deal with that.
让·米歇尔·穆勒 (Jean-Michel Muller) 的书和哈特 (Hart) 的书都是极好的推荐。
您真的有必要拥有版权吗?如果你能避免的话,那么进入编写数学库函数的行业通常是一个坏主意(我是作为一个专业人士这么说的)。我不知道 D 是否可以接受 BSD 许可的代码,但是有几个很好的开源实现可能会有所帮助。例如,您可能需要查看 Sun 的 FDLIBM。 Stephen Moshier 的 Cephes 也是一种可能,尽管它的许可情况有点奇怪,但我相信他过去一直愿意让人们根据其他许可证重新分发他的代码。
顺便说一句,除非您支持任意精度浮点(我认为 D 不支持),否则 libm 函数通常没有“渐近效率”的概念。
Jean-Michel Muller's book is an excellent recommendation, as is Hart.
Is it actually necessary for you to own the copyright? It's usually a bad idea to get into the business of writing math library functions if you can avoid it (and I say that as someone who does so professionally). I don't know whether or not D can take in BSD-licenced code, but there are several good open-source implementations that may prove helpful. You may want to look at Sun's FDLIBM, for example. Stephen Moshier's Cephes would also be a possibility, though its licensing situation is a little bit odd, but I believe that he's been willing to let people redistribute his code under other licenses in the past.
On a side-note, unless you're supporting arbitrary-precision floating-point (I don't think that D does), there isn't usually a notion of "asymptotic efficiency" for libm functions.
正如您所料,其他语言中也会出现类似的问题:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StrictMath.html
我不知道 D 的数学函数运行时计算规则是什么,但您也许可以采用类似的技巧 - 将 fdlibm 的 C 源重新解释为 D。如果 D 调用特定于平台的 C 库,那么您有问题是在编译时可能无法预测运行时值。
我认为 fdlibm 的许可证非常宽松,您必须自己检查它是否适合在 D 中重新分发。我见过的一个版本需要保留版权声明,仅此而已。
As you'd expect, similar issues arise in other languages:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StrictMath.html
I don't know what D's rules are for runtime calculation of math functions, but you may be able to pull a similar trick - re-interpret the C source of fdlibm as D. If D calls platform-specific C libraries, then you have the problem that it may be impossible at compile time to predict the runtime value.
I think fdlibm's license is very permissive, you'd have to check for yourself whether it's suitable for redistribution in D. One version I've seen requires a copyright notice to be preserved, and that's it.
我推荐的来源是 RW Hamming 的科学家和工程师的数值方法。
这本书由多佛出版社出版,是一本廉价的平装书。
The source that I recommend is Numerical Methods for Scientists and Engineers by R. W. Hamming.
This book is published by Dover Press, and is an inexpensive paperback.
请参阅《基本函数:算法与实现》一书
让-米歇尔·穆勒着。
See the book "Elementary Functions: Algorithms and Implementation"
by Jean-Michel Muller.
也许这对您有帮助(至少对于某些功能):
http://en.wikipedia.org/wiki/CORDIC
Maybe this helps you (at least for some of the functions):
http://en.wikipedia.org/wiki/CORDIC
多个来源,包括:
Abramowitz 和 Stegun,“数学函数手册”(可在线获取在线!)
Hart,“计算机近似”(已绝版,但很好)
还看到了其他几个关于三角函数的问题,包括“三角函数如何工作?" 和 "三角函数嵌入式系统”。
several sources, including:
Abramowitz and Stegun, "Handbook of Mathematical Functions" (available online!)
Hart, "Computer Approximations" (out of print but good)
also see the several other SO questions about trigonometry, including "How do Trigonometric Functions Work?" and "Trigonometric Functions on Embedded Systems".