[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] GSL overflow/underflow related to execution speed?
From: |
Pierre-Henri Wibaut |
Subject: |
[Help-gsl] GSL overflow/underflow related to execution speed? |
Date: |
Fri, 18 Dec 2009 13:07:49 +0100 |
Hello,
I've a really strange problem with GSL. I'm implementing a simulator and I need
to compute a fermi function, with exponential.
The programing language is O'Caml, with the ocamlgsl binding.
The fermi function is declared as:
let computeFermi = fun piA piB beta -> 1./.(1.+.( Gsl_sf.exp
((-.beta)*.(piB-.piA))));;
And I use it there:
let checkFitness mA mB beta ranGen=
try
begin
let piA = mA#getPayoff and piB = mB#getPayoff in
(*let () = print_endline ("piA:"^(string_of_float piA)^",
piB:"^(string_of_float piB)) in *)
let fermi = computeFermi piA piB beta and treshold = (uniform_pos
ranGen) in
(treshold<fermi);
end
with Gsl_error.Gsl_exn(m,n) -> false;;
The try with block doesn't work, I don't know why. Exception interrupts the
program... But the strange thing comes from the (actually commented) line :
(*let () = print_endline ("piA:"^(string_of_float piA)^",
piB:"^(string_of_float piB)) in *)
If this line is functional, the execution works pretty well (but is slow, cause
of print), if I comment this line and make it un-functional then I get
exception:
Fatal error: exception Gsl_error.Gsl_exn(17, "overflow") or Fatal error:
exception Gsl_error.Gsl_exn(16, "underflow")
The parameters are exactly the same. This exception is launched after some
iterations, so the code works well.
Is it related to execution speed? Because it's the only difference between the
2 versions. I use some Gsl_rng in the code, maybe it comes from that...
If anyone has an idea about this strange comportment.
Thank you,
WPH
- [Help-gsl] GSL overflow/underflow related to execution speed?,
Pierre-Henri Wibaut <=