异或Java中的两个双打 [英] XORing two doubles in Java

查看:127
本文介绍了异或Java中的两个双打的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在异或JAVA两个双打?

How to XOR two doubles in JAVA?

简单的'^'不双打工作...我将不得不转换为双二进制形式并做到这一点按位?或有任何其他方式?

simple '^' doesn't work for doubles... Would I have to convert a double to binary form and do it bitwise? or is there any other way?

推荐答案

如果你的意思是要做到这一点按位,你需要使用双击实用功能让重新presentations然后再转换回双重底:

If you mean to do this bitwise you need to use the Double utility functions to get long representations and then convert back to a double at the end:

double c = Double.longBitsToDouble(
    Double.doubleToRawLongBits(a) ^ Double.doubleToRawLongBits(b));

这篇关于异或Java中的两个双打的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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