我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Scala相当于Go的数学。

I was wondering if Scala or one of its well known math libraries (e.g. Spire) has an equivalent to Go's math.Nextafter function

package main

import (
    "fmt"
    "math"
)

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

(From http://tour.golang.org/#4)

And if not, what is the most "Scala" way to get the same functionality?

It's part of the Java Math library:

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

近期文章

  • Go递归函数调用是否经过尾部优化?
  • 切片节点结构中的未定义属性
  • Golang从字符串中的子字符串解析日期
  • 如何添加关系数据
  • 有没有一种方法可以为golang唯一地使用map [string] interface {}?
  • goftp软件包是否提供安全的文件传输?
  • 在分布式登台环境中模仿,记录和重放生产流量模式的策略是什么? [关闭]
  • 在运行中,为什么用[] int而不是int []? [关闭]
  • 警告:未使用的变量“ _cgo_a”
  • 如何在Go中从用户名切换用户?
  • 你好,世界继续前进,appengine:ctypes错误
  • 出现错误:“未使用fmt.Println”。 什么?
  • 使用反射来调用方法并返回值
  • 为什么此go代码失败?
  • 尝试安装依赖项时,VS Code总是失败
  • Go中并行Quicksort的死锁
  • 信号后golang http服务器正常关闭
  • 将JSON解码为map [string] map [string] string
  • 如何自动使测试在程序包中并行运行?
  • 将big.Int的最后8位放入uint8

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华