We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigonometric:tan doesn't match SBCL:
coalton-user> (coalton (tan (Complex 1.0d0 -1.0d0))) #C(0.2717525853195118 -1.0839233273386946) NEW-TRIG> (cl:tan #C (1.0d0 -1.0d0)) #C(0.27175258531951174 -1.0839233273386943)
I made an attempt as seen below, though it still doesn't match exactly, and causes NaN errors during identity tests.
;; unused first attempt (defpackage #:new-trig (:use #:coalton #:coalton-prelude) (:local-nicknames (#:math #:coalton-library/math))) (in-package #:new-trig) (coalton-toplevel (define (old-tan z) (let x = (real-part z)) (let y = (imag-part z)) (let c = (exp (complex y (negate x)))) (let recip-c = (/ 1 c)) ;; (i (e^(y - i x) - e^(-y + i x))) ;; / (e^(-y + i x) + e^(y - i x)) (/ (* math:ii (- c recip-c)) (+ c recip-c)))) (define (new-tan z) (let x = (real-part z)) (let y = (imag-part z)) (let e+y = (exp y)) (let e-y = (exp (negate y))) (let a = (/ (* (+ e+y e-y) (math:sin x)) 2)) (let b = (/ (* (- e+y e-y) (math:cos x)) 2)) (let c = (/ (* (+ e+y e-y) (cos x)) 2)) (let d = (/ (* (- e+y e-y) (sin x)) -2)) (let denom = (+ (^ c 2) (^ d 2))) (Complex (/ (+ (* c a) (* b d)) denom) (/ (- (* b c) (* a d)) denom))) ;; NEW-TRIG> (coalton (old-tan (Complex 1.0d0 -1.0d0))) ;; #C(0.2717525853195118 -1.0839233273386946) ;; NEW-TRIG> (coalton (new-tan (Complex 1.0d0 -1.0d0))) ;; #C(0.2717525853195117 -1.0839233273386946) ;; NEW-TRIG> (cl:tan #C (1.0d0 -1.0d0)) ;; #C(0.27175258531951174 -1.0839233273386943)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Trigonometric:tan doesn't match SBCL:
I made an attempt as seen below, though it still doesn't match exactly, and causes NaN errors during identity tests.
The text was updated successfully, but these errors were encountered: