Why are some casts from floating point to integral done differently

Walter Bright newshound1 at digitalmars.com
Mon Mar 15 14:31:23 PDT 2010


Don wrote:
> Walter Bright wrote:
>> Don wrote:
>>> I don't know, but it's probably historical. The real->ulong code is 
>>> quite recent (about a year old), but the other ones are ancient. They 
>>> may even come from the 386 days.
>>
>> Eh, go back a lot further!
> 
> Actually I suspected it might be from the x87 emulator days.
> So, the code is probably older than some of the posters to this newsgroup!
> 
> OT: My all-time favourite bit of code that I maintain is a little piece 
> of x87 asm which dates from 1981. Back then, Intel didn't even sell the 
> x87 directly, you had to buy it by mail-order from a guy in Silicon 
> Valley who lived near the Intel fab. It's great to see that code still 
> running on a quad-core 64 bit CPU!
> The app that was converted to Pascal at some point before the 90's, but 
> all of that's gone now. Yet the asm survived (with just AX->EAX->RAX)! 
> It was a fine piece of work.
> 
> 

The Digital Mars C compiler was started in 1982, and a lot of it still survives 
in the code base (library & compiler).

The evolution of the human brain is not done by replacing structures with new 
ones, but by putting new layers over the old ones and overriding them. Hence, we 
all have a notochord, and a dinosaur brain, etc. You can see that in the back 
end code; the original design and structure is intact, it's just been layered 
over. Maybe some day I should dig up NWC 1.0 and post it!

The D front end, however, is radically different from the C front end.



More information about the Digitalmars-d mailing list