fun i1 -> fun i2 ->
let r = i1 mod i2 in
if r = 0 then i2 else pgcd i2 r in
- let num_positive =
- if num_init >= 0 then num_init
- else (-num_init) in
- let denom_positive =
- if denom_init > 0 then denom_init
- else if denom_init < 0 then -denom_init
- else raise (Signal_operation "sample rate denominater = 0.") in
- let factor = pgcd num_positive denom_positive in
- let num_corrected = num_init / factor in
- let denom_corrected = denom_init / factor in
+ let factor =
+ if denom_init = 0 then
+ raise (Signal_operation "sample rate denominater = 0.")
+ else
+ pgcd (abs num_init) (abs denom_init) in
object (self)
- val _num = num_corrected
- val _denom = denom_corrected
+ val _num = num_init / factor
+ val _denom = denom_init / factor
method num = _num
method denom = _denom
method to_int =
new value (Vec (new vector size vec)) in
new signal freq func
-
method serialize : signal_type =
let size =
match (self#at 0)#get with