testvsinecos   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/core/extempore_lang.xtm

Implementation

(bind-func testvsinecos
  (lambda ()
    (let ((a:/4,float/* (alloc)))
      (vfill! a 0.1 0.2 0.3 0.4)
      (let ((b (vsinf4 (pref a 0)))
            (c (vcosf4 (pref a 0))))
        (printf "precision inaccuracy is expected:\n")
        (printf " sin:\t%f,%f,%f,%f\n"
                (ftod (sin 0.1))
                (ftod (sin 0.2))
                (ftod (sin 0.3))
                (ftod (sin 0.4)))
        (printf "vsinf:\t%f,%f,%f,%f\n"
                (ftod (vref b 0))
                (ftod (vref b 1))
                (ftod (vref b 2))
                (ftod (vref b 3)))
        (printf " cos:\t%f,%f,%f,%f\n"
                (ftod (cos 0.1))
                (ftod (cos 0.2))
                (ftod (cos 0.3))
                (ftod (cos 0.4)))
        (printf "vcosf:\t%f,%f,%f,%f\n"
                (ftod (vref c 0))
                (ftod (vref c 1))
                (ftod (vref c 2))
                (ftod (vref c 3)))
        void))))


Back to Index