我正在寻找一种办法,在 Java文中进行双向和64倍的愤怒。
Java本将把其所有双重价值纳入为开展双向行动而签署的32-bit integers(。
我正在寻找一种办法,在 Java文中进行双向和64倍的愤怒。
Java本将把其所有双重价值纳入为开展双向行动而签署的32-bit integers(。
Javascript代表所有数字如下:64-bit 。 (见ECMAscript spec, Section 页: 1 最多2^53的所有积极分类账均可准确编码。 较大的集聚物的减小幅度最小。 因此, Java字中你怎么能代表64倍的愤怒——土著数据类型显然能够代表64倍的内心。
下面说明这一点。 虽然javascript appears 能够将代表64位数的六位数按位数分列,但基本数字代表并不存在64位比数。 在您的行文中教授以下内容:
<html>
<head>
<script language="javascript">
function showPrecisionLimits() {
document.getElementById("r50").innerHTML = 0x0004000000000001 - 0x0004000000000000;
document.getElementById("r51").innerHTML = 0x0008000000000001 - 0x0008000000000000;
document.getElementById("r52").innerHTML = 0x0010000000000001 - 0x0010000000000000;
document.getElementById("r53").innerHTML = 0x0020000000000001 - 0x0020000000000000;
document.getElementById("r54").innerHTML = 0x0040000000000001 - 0x0040000000000000;
}
</script>
</head>
<body onload="showPrecisionLimits()">
<p>(2^50+1) - (2^50) = <span id="r50"></span></p>
<p>(2^51+1) - (2^51) = <span id="r51"></span></p>
<p>(2^52+1) - (2^52) = <span id="r52"></span></p>
<p>(2^53+1) - (2^53) = <span id="r53"></span></p>
<p>(2^54+1) - (2^54) = <span id="r54"></span></p>
</body>
</html>
在Landre,“ Chrome”和“Im”中,有以下内容。 如果数字储存在全部64美分中,那么结果应该是所有次点的1。 相反,你可以看到2^53+1和2^53之间的差额是如何消失的。
(2^50+1) - (2^50) = 1
(2^51+1) - (2^51) = 1
(2^52+1) - (2^52) = 1
(2^53+1) - (2^53) = 0
(2^54+1) - (2^54) = 0
因此,你可以做些什么?
如果你选择把64比特的重新归类为2,32比数,则适用两比办法,简单地适用2比特和两字,对低和高32比字。
例如:
var a = [ 0x0000ffff, 0xffff0000 ];
var b = [ 0x00ffff00, 0x00ffff00 ];
var c = [ a[0] & b[0], a[1] & b[1] ];
document.body.innerHTML = c[0].toString(16) + ":" + c[1].toString(16);
收到:
ff00:ff0000
这里的编号和编号为64, 您可以取代其他双向行动。
function and(v1, v2) {
var hi = 0x80000000;
var low = 0x7fffffff;
var hi1 = ~~(v1 / hi);
var hi2 = ~~(v2 / hi);
var low1 = v1 & low;
var low2 = v2 & low;
var h = hi1 & hi2;
var l = low1 & low2;
return h*hi + l;
}
现在可以采用新的BigInt建筑数字类型。 BigInt目前(2019年7月)只能在某些浏览器上提供,详见以下链接:
https://developer.mozilla.org/en-US/docs/Web/Java/Reference/Global_Objects/BigInt
我在“ Chrome67”中测试了双向行动,并可以证实,它们按预期使用最多64个比值。
Java字不支持盒子中的64个轨道分类账。 这是我最后做的:
Long
.Long
from the low and high bitNote: for the code example below to work you need to load long.js.
// Handy to output leading zeros to make it easier to compare the bits when outputting to the console
function zeroPad(num, places){
var zero = places - num.length + 1;
return Array(+(zero > 0 && zero)).join( 0 ) + num;
}
// 2^3 = 8
var val1 = Long.fromString( 8 , 10);
var val1High = val1.getHighBitsUnsigned();
var val1Low = val1.getLowBitsUnsigned();
// 2^61 = 2305843009213693960
var val2 = Long.fromString( 2305843009213693960 , 10);
var val2High = val2.getHighBitsUnsigned();
var val2Low = val2.getLowBitsUnsigned();
console.log( 2^3 & (2^3 + 2^63) )
console.log(zeroPad(val1.toString(2), 64));
console.log(zeroPad(val2.toString(2), 64));
var bitwiseAndResult = Long.fromBits(val1Low & val2Low, val1High & val2High, 真实情况);
console.log(bitwiseAndResult);
console.log(zeroPad(bitwiseAndResult.toString(2), 64));
console.log( Correlation betwen val1 and val2 ? );
console.log(bitwiseAndResult > 0);
青春期产出:
2^3
00000 0000
2^3 + 2^63
0010000000000000000000000000
2^3 & (2^3 + 2^63)
00000 0000
阀1与阀2之间的对应关系?
真实情况
不幸的是,已接受的答复(和其他答复)似乎没有经过充分测试。 最近,面对这一问题,我最初试图将我64个轨道的号码分为两点,如上所示,但还有一点小.。
开放 your本典,进入:
0x80000001
当你报到时,你获得2147483649美元,相当于ci。 下一步工作:
0x80000001 & 0x80000003
这使你——2147483647,而不是你所期望的。 很明显,在进行两次审查时,数字被视为已签署32项合同。 结果是错误的。 即便是你否认。
我的解决办法是,在32个轨道号码被拆解后,对消极信号进行核对,然后适当处理。
这是cl。 也许会有一个比较棘手的固定点,但我可以很快看到。 具有某种讽刺意味的是,可以由几条集会线完成的事情,在 Java文中应当要求更多的劳动力。
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...
I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...
Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph? The array is multidimensional, with three elements in each part - and the ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.