herbie-fp / odyssey

A platform for exploring floating-point expressions :boat:
https://herbie-fp.github.io/odyssey/
MIT License
19 stars 0 forks source link

Math JS error for FPCore input. #155

Open zaneenders opened 1 month ago

zaneenders commented 1 month ago

Getting an error for the following FPCore.

Screenshot 2024-10-31 at 9 57 55 AM
(FPCore (a b angle x-scale y-scale)
  (let* ([θ (* (/ angle 180) PI)]
         [F (* (* b a) (* b (- a)))]
         [A (/ (/ (+ (pow (* a (sin θ)) 2) (pow (* b (cos θ)) 2))
                x-scale) x-scale)]
         [B (/ (/ (* (* (* 2 (- (pow b 2) (pow a 2))) (sin θ)) (cos θ))
                x-scale) y-scale)]
         [C (/ (/ (+ (pow (* a (cos θ)) 2) (pow (* b (sin θ)) 2))
                y-scale) y-scale)])
        (- (* B B) (* (* 4 A) C))))
elmisback commented 4 weeks ago

So this is being handled in a weird way where it's casting the FPCore to MathJS and then back to FPCore to get the variable names. We should just save the FPCore and stick to using that if it's available. In general, we should shift things toward using FPCore as the primary internal representation for Odyssey.