std.math performance (SSE vs. real)

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 29 14:30:29 PDT 2014


On Sun, 2014-06-29 at 19:02 +0000, David Nadlinger via Digitalmars-d
wrote:
[…]
> There is nothing Humpty Dumpty about the current situation. You 
> are simply missing the fact that float and double are already 
> defined as 32 bit/64 bit IEEE 754 compliant floating point 
> numbers in the spec.
> 
> There is nothing ambiguous about that, just as char/int/long have 
> defined bit-widths in D.

I think I am probably just getting "bloody minded" here, but…

If D is a language that uses the underlying hardware representation then
it cannot define the use of specific formats for hardware numbers. Thus,
on hardware that provides IEEE754 format hardware float and double can
map to the 32-bit and 64-bit IEEE754 numbers offered. However if the
hardware does not provide IEEE754 hardware then either D must interpret
floating point expressions (as per Java) or it cannot be ported to that
architecture. cf. IBM 360.

Fortunately more recent IBM hardware has multiple FPUs per core, one of
which provides IEEE754 as an option. (Pity the other FPUs cannot be
used :-)

Corollary: if D defines the "hardware" representation in its data model
then it can only be ported to hardware that uses that representation.

PS Walter just wrote that the type real is not defined as float and
double are, so it does have a Humpty Dumpty factor even if float and
double do not.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140629/440bc3d5/attachment.sig>


More information about the Digitalmars-d mailing list