- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我知道 StrictMath
遵循给定的算法,并且会在每台机器上给出相同的结果;然而,数学更准确,而且我发现它被更多地使用。哪个是首选?显然,我想要可重复性,但准确性对我来说也很重要。
最佳答案
基于 accuracy 的真实定义,StrictMath
更准确。一般来说,Math
比 StrictMath
更快,但情况并非总是如此;通常,Math
库函数只是调用 StrictMath
实现。
无论如何,我认为您的问题的答案可以直接从 Math
找到。 Javadoc:
Unlike some of the numeric methods of class StrictMath, all implementations of the equivalent functions of class Math are not defined to return the bit-for-bit same results. This relaxation permits better-performing implementations where strict reproducibility is not required.
By default many of the Math methods simply call the equivalent method in StrictMath for their implementation. Code generators are encouraged to use platform-specific native libraries or microprocessor instructions, where available, to provide higher-performance implementations of Math methods. Such higher-performance implementations still must conform to the specification for Math.
对于大多数应用程序来说,通用的 Math 库是更好的选择。如果需要考虑非常小的舍入误差,则需要使用 StrictMath
。因此,除非您的准确性必须非常高,否则不要因为不一致而陷入困境。
关于java - 在 Java 中,为了一致性,StrictMath 仍然优于 Math 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32977034/
GhostScript PDF/A 生成好像有错误 当您通过 GhostScript 生成 PDF/A 文档时,当您单击 Adobe Reader 时,会出现一个一致性选项卡,其中显示: “一致性
我有一个需要测试的 XPath 引擎实现。 是否有一组标准的一致性测试可以用来验证是否符合 XPath 规范(与 XSLT 相关)。 什么将是完美的 XML 文档 XPath 表达式和预期的结果。 最
帮助我了解在这种情况下我可以期望与 MongoDB 的一致性级别。 我们正在运行一个副本集,其中 Mongoid 中的 consistency 标志设置为 strong,这意味着只读到 master。
假设我有一个采用一个参数的方法。 此参数应满足以下要求: 'of type':方法需要知道参数属于特定类(或子类)。 'implements interface':方法需要知道参数实现了特定的接口(i
当协议(protocol)将属性声明为可选而具体类型将其声明为非可选时,如何使具体类型符合协议(protocol)? 这是问题所在: protocol Track { var trackNum
我正在考虑使用浏览器的 navigator.mimeTypes 数组作为第三级用户/浏览器标识符。例如,当我在 Chrome 上运行时... console.log(navigator.mimeTyp
我有以下协议(protocol): protocol ProtoAInput { func funcA() } protocol ProtoA { var input: ProtoAI
如果选择“最终”一致性,则发生写入的区域内的一致性是什么? 如果我只需要区域强一致性,应该选择哪个选项? 最佳答案 如果您需要在主要区域内进行强读取,则应该选择强一致性或有界过时一致性。 关于azur
您好,我是一名初学者,目前正在尝试学习 java 编程。课本上的问题: 编写一个程序来帮助人们决定是否购买混合动力汽车。你的程序的输入应该是:•新车的成本•预计每年行驶里程•预计汽油价格 •每加仑英里
我正在尝试制作一个可以在 UILabel 上使用的 Swift 协议(protocol), UITextField , 和 UITextView包含他们的text , attributedText ,
我有一个类扩展: extension UICollectionViewCell { class func registerFromNibInCollectionView(collectionV
为了在 Swift 中模拟对象进行测试,我通常遵循这样的模式:编写一个协议(protocol)来描述我想要的对象的行为,然后使用 Cuckoo 为其生成模拟以进行测试。 通常,这些协议(protoco
假设我有两个非通用协议(protocol)(1) protocol StringValue { var asString: String {get} } protocol StringProv
我有一组协议(protocol)可以在 UITableView 中显示一个元素: protocol TableRepresentableRow { var title: String { get
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
用“class”标记 CacheManager 解决了我的问题。 案例:一个简单的缓存器,mutating get 不是我想要的,那么对于引用类型或类类型应该怎么做? protocol Cacher
我想要一个符合协议(protocol)的变量,但是 swift 编译器告诉我协议(protocol)没有确认。 protocol A {} protocol B { var a : A { g
如果我有一个类 Christmas 和一个协议(protocol) Merry,要使 Christmas 符合 Merry,很多人会这样做: class Christmas { ... } e
@objc public protocol P1 { func p1foo() } @objc public protocol P2 { func p2foo() } class A: NSO
我有一些结构符合的基本协议(protocol)(模型)。它们也符合 Hashable protocol Model {} struct Contact: Model, Hashable { v
我是一名优秀的程序员,十分优秀!