mirror of https://github.com/rusefi/bldc.git
20 lines
449 B
Common Lisp
20 lines
449 B
Common Lisp
|
|
(define close-enough
|
|
(lambda (x y)
|
|
(if (> x y)
|
|
(< (- x y) 0.0001)
|
|
(< (- y x) 0.0001)
|
|
)))
|
|
|
|
(define arr (array-create type-byte 16))
|
|
|
|
(bufset-f32 arr 0 3.14)
|
|
(bufset-f32 arr 4 666.666)
|
|
(bufset-f32 arr 8 100)
|
|
(bufset-f32 arr 12 42)
|
|
|
|
(and (close-enough (bufget-f32 arr 0) 3.14)
|
|
(close-enough (bufget-f32 arr 4) 666.666)
|
|
(close-enough (bufget-f32 arr 8) 100)
|
|
(close-enough (bufget-f32 arr 12) 42))
|