双精度值 [英] Double precision values

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

问题描述

在我参加Google Code Jam资格赛前一天。这是我在网络编码比赛中的第一次经历。这是非常有趣的。

Just a day before I participated in the qualification round of Google Code Jam. This is my first experience of such an online coding contest. It was really fun.

有三个问题,我能够解决两个问题。但是,在我遇到的问题之一,我被要求处理真正巨大的价值观。我是一个Java人,我以为我会去双变量。不幸的是,双倍的精度还不够。此外,我在结束阶段参加了这次,我没有时间挖掘它(加上解决1足以符合下一个阶段)。

There were three problems given of which i was able to solve two. But on one of the problems I was asked to work with values that are really huge. I am a Java guy and I thought I would go for double variable. Unfortunately, the precision of double also was not enough. Moreover, I attended this during the closing stage, I was not having the time to dig much into it (plus solving 1 is enough to qualify to the next stage).

我的问题是这样,如何使精度机制大于双倍。我的编码经验是在Java中,所以如果你可以回答这个问题,那将是很棒的。

My question is this, How to have a precision mechanism that is greater than double. My coding experience is in Java, so it would be great if you could please answer in that lines.

谢谢

推荐答案

Java有 BigDecimal l 进行任意精度算术 - 但是比使用 double 要慢得多。

Java has BigDecimall for arbitrary-precision arithmetic - but it's much, much slower than using double.

还有可能通过使用代数变换,例如,使用对数。

It's also possible that the problem in question was supposed to be soved by using algebraic transformations and e.g. work with logarithms.

这篇关于双精度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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