的&QUOT任何同等;扩展"对于C#? [英] Any equivalent of "extended" for C#?

查看:156
本文介绍了的&QUOT任何同等;扩展"对于C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作我的曼德尔布罗屏保,然后我跑出来简单 - 浮点精度值没有满足我的需求不够显著数字。



更多显著数字变焦=进分



的更高水平当我在Delphi 7写了一个版本的屏幕保护

返回,我用了延长浮点类型,尺寸为80位。



在.NET中,我可以切换到的小数,但是这方面的性能影响是可怕的,由20个左右的因素放缓的分形生成。



是否有.NET中的扩展任何等效?或者,是否有任何数字类型比更高的精度双击仍然使用FPU进行评估,因此不具备的十进制的高性能命中



更新



我的屏保已经管理许多(很多放大到分形!级)的订单;目前其重置为基本形,只有当所使用的数字类型无法纵坐标为相邻像素分开。从双扩展改进的精度额外的16位会给我接近大小16多个倍增。



至于性能,我的算法已经设法消除95- 99%的要求(相对于一个天真的实现,计算许多像素),同时保留了分形的完整性数学。


解决方案

在64位平台上,扩展类型是双重的别名,其中
只有8个字节。在32位平台上,一个扩展号表示为10个字节(80位)。




这意味着,即使你的Delphi程序可能无法在64位平台上运行良好。



如果你需要一个数字数据类型比64位更然后去小数和优化算法来提高性能。


I'm working on a new version of my Mandelbrot screensaver and I'm running out of floating point accuracy - simple double values don't have enough significant figures for my needs.

More significant figures = greater levels of zooming into the fractal

Back when I wrote a version of this screensaver in Delphi 7, I used the extended floating point type, 80 bits in size.

In .NET, I could switch to decimal, but the performance hit for this is terrible, slowing down fractal generation by a factor of 20 or so.

Is there any equivalent of extended for .NET? Or, alternatively, are there any numeric types with higher precision than double that still use the FPU for evaluation and therefore don't have the high performance hit of decimal?

Update

My screensaver already manages to zoom into the fractal by many (many!) orders of magnitude; currently it resets to the base fractal only when the numeric type in use is unable to separate the ordinates for adjacent pixels. The extra 16 bits of precision from the double-extended improvement would give me close to 16 more doublings of size.

As to performance, my algorithm already manages to eliminate 95-99% of the math required (as compared to a naive implementation that calculates many pixels), while retaining the integrity of the fractal.

解决方案

On 64-bit platforms, the Extended type is an alias for Double, which is only 8 bytes. On 32-bit platforms, an Extended number is represented as 10 bytes (80 bits).

That means even your Delphi program may not perform well in 64bit platforms.

If you need a numeric data type with more than 64bits then go for decimal and optimize your algorithms to improve performance.

这篇关于的&QUOT任何同等;扩展"对于C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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