Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Batteries;;
- let of_float_string a =
- match Str.split (Str.regexp "\\.") a with
- [] -> failwith "Empty string"
- | iprt_str :: [fprt_str] -> (
- let iprt = Num.of_string iprt_str in
- let power = string_of_int (int_of_float (10.0 **
- (float_of_int (String.length fprt_str)))) in
- let fprt = Num.of_string (String.concat "/" [fprt_str; power]) in
- Num.(+) iprt fprt)
- | _ :: a -> failwith "Too much point in the value"
- ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement