【问题标题】:The Scala equivalent to Go's math.NextafterScala 等价于 Go 的数学。Nextafter
【发布时间】:2013-07-23 00:26:13
【问题描述】:

我想知道 Scala 或它著名的数学库之一(例如 Spire)是否具有与 Go 的 math.Nextafter 函数等效的功能

package main

import (
    "fmt"
    "math"
)

func main() {
    fmt.Printf("Now you have %g problems.",
        math.Nextafter(2, 3))
}

(来自http://tour.golang.org/#4

如果不是,获得相同功能的最“Scala”方式是什么?

【问题讨论】:

    标签: scala go


    【解决方案1】:

    它是 Java Math 库的一部分:

    scala> java.lang.Math.nextAfter(2.0,3)
    res0: Double = 2.0000000000000004
    

    【讨论】:

      猜你喜欢
      • 2015-04-27
      • 2014-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-15
      • 1970-01-01
      相关资源
      最近更新 更多