[racket-dev] extflonum unboxing, f80vector ffi

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Feb 18 12:16:11 EST 2013

At Mon, 18 Feb 2013 20:37:22 +0400, Dmitry Pavlov wrote:
> 1. Minor issue: broken contract does not check for some
> reason related to the unboxing machinery:
> 
> (require racket/extflonum)
> 
> (define (a b)
>    (extfl+ b 1.0))
> 
> (a 1.0t0)
> 
> Should raise "extfl+: contract violation", but silently returns
> NaN instead. If one puts (extfl+ 1.0 b) instead of (extfl+ b 1.0),
> it works fine. If one turns off the unboxing (by undefining
> USE_EXTFLONUM_UNBOXING), it works fine too.

I'll push a repair.

This bug turns out not to be be extflonum-specific: it affects flonums,
too. Thanks for finding it!

> 2. Windows build. Since MinGW is hard, Michael thinks to
> give Visual Studio a try, by implementing long doubles
> with inline assembly.

I had a similar thought, but what about the various functions that the
C library provides, such as powl() and cosl()?

It may be possible to compile and link a MinGW-based DLL to provide
those functions, and then dynamically load them for use by an
MSVC-compiled executable. (The DLL could be added to the set of
separately build DLLs that are downloaded during a Racket build.)


Posted on the dev mailing list.