floor()/ int()函数的实现 [英] floor()/int() function implementaton

查看:162
本文介绍了floor()/ int()函数的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何实现方法/函数 Int() floor()
我正在寻找一个相应的实现,因为以下是针对 abs()函数的。

Does anyone have an idea how is the method/function Int() or floor() implemented? What I am looking for a respective implementation as the following is for abs() function.

Int Abs (float x){
  if x > 0 
      return x;
   else
      return -x
}

我很努力

推荐答案

对我来说,就像

floor(n) = n - (n % 1)

应该有所斩获。

这篇关于floor()/ int()函数的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆