lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thursday 16 June 2005 00.39, Glenn Maynard wrote:
> On Wed, Jun 15, 2005 at 03:07:52PM -0700, Chris Marrin wrote:
> > Actually all machines can have all these data types, it's just a
> > simple matter of software :-)
> 
> That's purely intellectual; if a machine doesn't have doubles in
> hardware, softawre emulation is uselessly slow.

True in this specific case, but not universally.

Consider emulated 64 bit integers, for example. On a 32 bit compiler 
with emulation, they provide a shortcut to 32 bit MUL instructions 
generating 64 bit results and other features that are almost required 
for serious, fast fixed point math, available on most, if not all 
general purpose CPUs, but normally not accessible from high level 
languages. (If you've tried writing fixed point DSP code in both asm 
and pure C, you know what I'm talking about...)

Some old compilers supported simplified, emulation friendly floating 
point types that could significantly speed up FP math on FPU-less 
machines. IIRC, Borland's 16 bit Pascal compilers had a non-standard 
48 bit FP format for this purpose...


> > 2) it is easier for content 
> > authors (non-programmers) to understand 1.5 seconds than 1500000 
> > microseconds.
> 
> That's an implementation detail; non-programmers don't care how
> you're representing times internally.  printf("%i.%06i", i/1000000,
> i%1000000);

Exactly! It's a user interface thing - so deal with it on the UI 
level, instead of taxing all the machinery below.


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---