Browse thread
[Caml-list] Easy solution in OCaml?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christophe TROESTLER <debian00@t...> |
| Subject: | [Caml-list] Re: IEEE-754 (was: Easy solution in OCaml?) |
On Sat, 26 Apr 2003, Brian Hurt <brian.hurt@qlogic.com> wrote:
>
> On Sat, 26 Apr 2003, Siegfried Gonzi wrote:
>
> > dividing the two vectors:
> > (vector 0.0 0.0 23.34 23.4) through (vector 0.0 0.0 0.0 23.4)
> >
> > (vector #f #f #f 1.0)
>
> Hmm? What platform are you on? Linux on x86:
>
> # let x = [ 0.0 ; 1.0 ; 0.0 ; 1.0 ]
> and y = [ 0.0 ; 0.0 ; 1.0 ; 1.0 ] ;;
List.map2 ( /. ) x y
> - : float list = [nan.; inf.; 0.; 1.]
This is a feature of IEEE-754 arithmetic which means it should work
this way on virtually all architectures.
BTW, may I take this opportunity to advertise my little wishlist in
this respect ? I'd like to have:
FAST is_nan : float -> bool
is_finite : float -> bool
(I know it is possible to define them with
classify_float but is is not fast)
and copysign : float -> float -> float
Cheers,
ChriS
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners