开发者

Alternative real number representation

I'm currently doing work on an optimisation algorithm that requires real numbers (Java doubles, to be specific) be converted into bit strings (again, to be specific: an ordered collection of Java booleans) and back again*. The scheme used is that the first bit indicates whether the value lies in 开发者_运维问答the first or second half of the range; the second bit subdivides the halves again, and so on.

The self-made algorithm I'm using to do this works fine when working with ranges that have a specified upper and lower value, however things get problematic when I try to use the full range of the Java double (I think, although I'm not sure, that the problem is related to the fact that Double.MAX_VALUE - (-1.0 * Double.MAX_VALUE) > Double.MAX_VALUE). That, however, isn't my question today. I'm sure I'm not the first one to try to use a number representation like this, so I'm sure the answers to my problems are out there on the Interwebs; I'm just not sure what to search for. What do you call such a representation of real numbers?


* Obviously, the number of bits used places a limit on the precision; I'm aware of and accept this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜