Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
生成 0 到 1 之间的随机浮点数
我正在尝试生成一个 0 到 1 之间的随机数 我一直在阅读arc4random 但没有任何关于从中获取浮动的信息 我该怎么做呢 随机值在 0 1 含0 不含1 double val double arc4random UINT32 MAX
ios
c
Random
floatingpoint
arc4random
使用 Haskell 范围:为什么跨范围映射浮点函数会导致它返回额外的元素?
我知道浮点数由于其不精确的性质可能会导致范围内的奇怪行为 我预计可能存在不精确的值 例如 0 1 0 3 1 可能会给 0 1 0 3 0 5 0 7 0 8999999999999999 代替 0 1 0 3 0 5 0 7 0 9 然而
Haskell
floatingpoint
range
浮点运算是否会导致 IEC 559/IEEE 754 浮点类型的无限未定义行为
我正在读无穷大不是 constexpr 这似乎表明创建无穷大是未定义的行为 expr 4 如果在计算表达式期间 结果未在数学上定义或不在其类型的可表示值范围内 则行为未定义 然而 如果std numeric limits is iec559
c
floatingpoint
languagelawyer
C17
C20
16 位浮点数和 GL_HALF_FLOAT
我正在寻找 编写一个 16 位浮点数的 C 实现 以便与 OpenGL 顶点缓冲区 纹理坐标 法线等 一起使用 到目前为止 这是我的要求 必须是 16 位 显然 必须能够使用 GL HALF FLOAT 上传到 OpenGL 顶点缓冲区 必
c
OpenGL
floatingpoint
CoreGraphics 中的浮点比较(相等)
Apple CoreGraphics framework CGGeometry h CG INLINE bool CGSizeEqualToSize CGSize size1 CGSize size2 return size1 width
Comparison
geometry
floatingpoint
coregraphics
equality
十六进制浮点文字
是否可以在 C 中使用十六进制浮点值初始化浮点变量 像这样的东西 double d 0x011 1 wrong 技术规格P0245 C 的十六进制浮点数已于 2016 年 2 月在佛罗里达州杰克逊维尔的 ISO C 标准委员会投票进入 C
c
floatingpoint
Hex
无限循环heisenbug:如果我添加打印输出,它就会退出
这是我的源代码 include
c
floatingpoint
infiniteloop
奇怪的for循环问题
我不确定这是否是一个错误 所以我想也许你们可能想看一下 问题出在这段代码上 for i 0 1 05 do print i end 输出应该是 0 05 1 snip 95 1 相反 输出是 0 05 1 snip 95 while 循环也
lua
floatingpoint
为什么我的数字四舍五入不正确?
这感觉像是那种只会在原地失败的代码 但我会尝试将其改编成代表我所看到内容的代码片段 float f myFloat myConstInt Where myFloat 13 45 and myConstInt 20 int i int f i
c
floatingpoint
rounding
floatingaccuracy
java中双精度乘法的精度?
java中双精度值的乘法运算符的保证精度是多少 例如 2 2 100 是 220 00000000000003 但 220 是双精度数 220 00000000000003 是 220 之后的下一个双精度值 乘法工作正常 但是2 2不能精确
Java
floatingpoint
multiplication
doubleprecision
IBM 到 IEEE 浮点转换
java中是否有任何标准方法可以将IBM 370 以字节形式 转换为IEEE格式 任何转换算法都会有所帮助 我尝试编写java代码 但我不明白我哪里出错了 当我将输入指定为 2 000000000000000E 02 时 我得到的值为 IE
Java
floatingpoint
IEEE754
如果十进制的范围更短,为什么它比双精度更精确? C#
Im reading the C in a Nutshell book and it shows this table 我很难理解这张桌子 它说双重需要64 bits的空间 它的范围是10 324 to 10 308 小数取128 bits
c
floatingpoint
double
Decimal
iphone:如果浮点数为负数,则转换为无符号整数的浮点数将设置为 0?
试试看 volatile float bob 344 0f unsigned int fred unsigned int bob printf d n fred 输出将为 0 显然 我希望它能够回绕 就像我从一个有符号的 int 转换为一个
c
iphone
casting
floatingpoint
typeconversion
除法和浮点数
任何人都可以帮助我为什么 x2 打印零 我想因为浮点表示 X1 被四舍五入 有没有办法保持进动 long double x1 x2 x1 0 087912088 Note 360 4095 0 087912088 x2 360 4095 p
c
floatingpoint
floatingaccuracy
如何将字符串解析为 float 或 int?
我怎样才能转换str to float 545 2222 545 2222 我怎样才能转换str to int 31 31 For the reverse see Convert integer to string in Python an
python
Parsing
floatingpoint
typeconversion
Integer
PHP - 浮点数精度[重复]
这个问题在这里已经有答案了 a 35 b 34 99 echo a b 结果为 0 009999999999998 这是怎么回事 我想知道为什么我的程序不断报告奇怪的结果 为什么 PHP 没有返回预期的 0 01 因为浮点运算 实数运算 对
php
floatingpoint
precision
floatingaccuracy
C# 从字符串中解析浮点数
我正在从 XML 文件中读取数字 其他数字带有逗号分隔符 0 1111 其他数字带有点 0 1111 我如何解析这些数字才能最终得到所需的结果 我尝试使用float Parse reader Value System Globalizati
c
Parsing
floatingpoint
浮点相等测试和额外精度:此代码会失败吗?
讨论开始于我对另一个问题的回答 下面的代码确定机器厄普西隆 float compute eps float eps 1 0f while 1 0f eps 1 0f eps 2 0f return eps 在评论中有人建议1 0f eps
c
floatingpoint
Comparison
precision
equality
浮点数的符号
有没有一种简单的方法来确定浮点数的符号 我进行了实验并想出了这个 include
c
floatingpoint
signedness
python float 到 int 转换
我有一个问题真的让我抓狂 通常做int 20 0 会导致20 到目前为止 一切都很好 但 levels int gex dict i for i in sorted gex dict keys while gex dict i 返回一个浮点
python
floatingpoint
«
1 ...
43
44
45
46
47
48
49