On 19 November 2012 19:28, Iain Buclaw <span dir="ltr"><<a href="mailto:ibuclaw@ubuntu.com" target="_blank">ibuclaw@ubuntu.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 19 November 2012 16:04, Manu <<a href="mailto:turkeyman@gmail.com">turkeyman@gmail.com</a>> wrote:<br>
> On 19 November 2012 06:19, Walter Bright <<a href="mailto:newshound2@digitalmars.com">newshound2@digitalmars.com</a>> wrote:<br>
>><br>
>> On 11/18/2012 4:31 PM, Manu wrote:<br>
>>><br>
>>> If I told you this is how real should be implemented, would you vote ++?<br>
>>> What<br>
>>> about double? Why?<br>
>>> Why not float for that matter? There seems like no reason for the<br>
>>> language to<br>
>>> define any floating point type at all if you consider this acceptable...<br>
>><br>
>><br>
>> Because they are implemented in hardware. It's pretty dang hard for a<br>
>> compiler to look at a floating point emulator and figure out "gee, I have a<br>
>> nice hardware instruction that does the same thing as this 2K of code!"<br>
><br>
><br>
> Right, and this is my point precisely. It's hard for GDC for instance to<br>
> hook some complex library because it happens to have hardware to do it.<br>
><br>
>>> 'half' isn't some custom float for niche use, it's an established<br>
>>> standard,<br>
>>> implemented in vastly more hardware than implements 'real'.<br>
>><br>
>><br>
>> It's implemented in GPUs, sure, but it is it implemented in hardware that<br>
>> D runs on? (I do know about this:<br>
>> <a href="http://gcc.gnu.org/onlinedocs/gcc/Half_002dPrecision.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc/Half_002dPrecision.html</a>)<br>
>><br>
>> There is no major technical difficulty in implementing it as a basic type,<br>
>> but I want to be sure we've exhausted the library approach first.<br>
><br>
><br>
> Well it's available in hardware on basically all mobile devices (that's a<br>
> LOT of devices (in the billions)), but even if it's just implemented in<br>
> software (x86), the values are consumed by the GPU, and the validity of the<br>
> values is no less important. It still seems like a valuable 1st class type;<br>
> why shouldn't it enjoy the same casting, assignment, literal, range checking<br>
> rules as the rest of the floats? Additionally, convenience and compatibility<br>
> with generic code would be significantly improved.<br>
> I don't see how it can be made to feel seamless with a lib... and that<br>
> sounds like an awful lot more work.<br>
><br>
><br>
> Anyway, I'm not desperate for this personally. I just wondered how people<br>
> felt about it in general, and if it was something that should/would be<br>
> seriously considered.<br>
<br>
</div></div>I'm neither here nor there.  I'm just pointing out that you are<br>
proposing a dedicated type to be introduced that is supported on only<br>
one platform. :-)<br></blockquote><div><br></div><div>real is only supported on one platform (x86, it's deprecated in x64 and x87 will likely be removed/emulated in the future), but I think many here consider it valuable(?).</div>
<div>And that's not strictly true either, virtually every machine has a GPU, and host software still has to process data for it. I'm mainly encouraging this for the sake of correctness/type safety, though hardware support on ARM would be a particularly nice bonus.</div>
<div><br></div><div>I also wanted to gauge the interest/opposition.</div></div></div>