Skip to content
New issue

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

Local error tree for if expressions #1045

Open
zaneenders opened this issue Nov 14, 2024 · 2 comments
Open

Local error tree for if expressions #1045

zaneenders opened this issue Nov 14, 2024 · 2 comments

Comments

@zaneenders
Copy link
Collaborator

This is a write of an issue in batch mode for cleanup-localize and zane-true-error giving all nans.

// clipped from testAPI.mjs
const localError7 = await (await fetch(makeEndpoint("/api/localerror"), {
  method: 'POST', body: JSON.stringify({
    formula: FPCoreFormula3, sample: [[[2e269], ignoredValue]], seed: 5
  })
})).json()

adding to localize.rkt

(for ([spec (in-list compare-specs)])  ; line 286
  (eprintf "compare-spec: ~a\n" spec))
(eprintf "pt*: ~a\n" pt*) ; line 310
(eprintf "deltas: ~a\n" deltas) : 312

Which gives the following output:

Local error Job local-error started:
  8ef7bf18e333e70b6b3e0347b5eee4e42ddb1549 (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.05) (* 0.5 (sqrt (/ 1.0 x))) (fma (fma (- 0.125) x 0.5) x (- 1.0 (sqrt x))))...
compare-spec: (fabs (- (if (<= (- (sqrt (+ x 1)) (sqrt x)) 3602879701896397/72057594037927936) (* 1/2 (sqrt (/ 1 x))) (+ (* (+ (* (neg 1/8) x) 1/2) x) (- 1 (sqrt x)))) -exact-for-0))
compare-spec: 0
compare-spec: (fabs (- (- (sqrt (+ x 1)) (sqrt x)) -exact-for-2))
compare-spec: (fabs (- (sqrt (+ x 1)) -exact-for-3))
compare-spec: (fabs (- (+ x 1) -exact-for-4))
compare-spec: (fabs (- x -exact-for-5))
compare-spec: 0
compare-spec: (fabs (- (sqrt x) -exact-for-7))
compare-spec: 0
compare-spec: (fabs (- (* 1/2 (sqrt (/ 1 x))) -exact-for-9))
compare-spec: 0
compare-spec: (fabs (- (sqrt (/ 1 x)) -exact-for-11))
compare-spec: (fabs (- (/ 1 x) -exact-for-12))
compare-spec: (fabs (- (+ (* (+ (* (neg 1/8) x) 1/2) x) (- 1 (sqrt x))) -exact-for-13))
compare-spec: (fabs (- (+ (* (neg 1/8) x) 1/2) -exact-for-14))
compare-spec: (fabs (- (neg 1/8) -exact-for-15))
compare-spec: 0
compare-spec: (fabs (- (- 1 (sqrt x)) -exact-for-17))
pt*: (2e+269 1.1180339887498948e-135 #t 0.0 4.4721359549995795e+134 2e+269 2e+269 1.0 4.4721359549995795e+134 0.05 1.1180339887498948e-135 0.5 2.2360679774997897e-135 5e-270 0.0 -2.5e+268 -0.125 0.125 -4.4721359549995795e+134)
deltas: #(+nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0 +nan.0)

One test for this could be on line 233 of testApi.mjs

checkLocalErrorNode(localError7.tree, [0, 0],
  '-', '61.2', '0.0', '1.1180339887498948e-135', '1.1180339887498948e-135', '61.16647760559045')
@zaneenders
Copy link
Collaborator Author

Here is a trimmed-down version of testApi.mjs. Renamed to .txt because of Git hub upload restrictions.
testApi.txt

@pavpanchekha
Copy link
Contributor

Not surprised if this is fixed by herbie-fp/rival#83 or #1050.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants