Commit 9f2d1e7f authored by Kim Nguyễn's avatar Kim Nguyễn
Browse files

Improve the Float library and fix a bug in the dlink module (the computed path...

Improve the Float library and fix a bug in the dlink module (the computed path was not passed to Dynlink.loadfile).
parent 00e1dfc0
......@@ -507,9 +507,9 @@ cduceres.o: win32/cduce.rc win32/cduce_logo-bw.ico
# Stdlib
stdlib: $(STDLIB_CMXS) $(STDLIB_CMO) $(STDLIB_CDO)
stdlib: $(CDUCE) $(STDLIB_CMXS) $(STDLIB_CMO) $(STDLIB_CDO)
%.cdo: %.cd cduce
%.cdo: %.cd $(CDUCE)
@echo "Build $@"
$(HIDE) ./cduce --compile --allow-cduce-unsafe-ns --depends -I stdlib $<
......
......@@ -27,7 +27,5 @@ let load ?digest ?real_name name =
(aname, digest)
with Not_found ->
Hashtbl.add obj_table path digest;
Dynlink.loadfile aname;
Dynlink.loadfile path;
(aname, digest)
link "stdlib/cduce_float"
link "cduce_float"
namespace cduce_ = "http://www.cduce.org/#UNSAFE"
type t = Float
let pow : (Float -> Float -> Float) = cduce_:cduce_pow
let pow = cduce_:cduce_pow
let sqrt = cduce_:cduce_sqrt
let exp = cduce_:cduce_exp
let log = cduce_:cduce_log
let log10 = cduce_:cduce_log10
let log2 = cduce_:cduce_log2
let cos = cduce_:cduce_cos
let sin = cduce_:cduce_sin
let tan = cduce_:cduce_tan
let acos = cduce_:cduce_acos
let asin = cduce_:cduce_asin
let atan = cduce_:cduce_atan
......@@ -10,4 +10,80 @@ let () =
(fun v1 v2 ->
Value.float ((Value.of_float v1) ** (Value.of_float v2))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_sqrt" float float
(fun v ->
Value.float (sqrt(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_exp" float float
(fun v ->
Value.float (exp(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_log" float float
(fun v ->
Value.float (log(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_log10" float float
(fun v ->
Value.float (log10(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_log2" float float
(fun v ->
Value.float (log(Value.of_float v) /. (log 2.))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_cos" float float
(fun v ->
Value.float (cos(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_sin" float float
(fun v ->
Value.float (sin(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_tan" float float
(fun v ->
Value.float (tan(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_acos" float float
(fun v ->
Value.float (acos(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_asin" float float
(fun v ->
Value.float (asin(Value.of_float v))
)
let () =
register_fun
~ns:Ns.cduce_unsafe_ns "cduce_atan" float float
(fun v ->
Value.float (atan(Value.of_float v))
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment