github / github/codeql-cli-binaries

float.toString() result is lossy

Offen
#58 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Complexity: Medium Engine: Evaluator
Vorherrschende Sprache
Keine Sprachdaten
Sterne
1k
Forks
184
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

It appears the built-in predicate `float.toString()` causes precision loss for the result. This can be irritating and also prevents using it in QL `InlineExpectationsTest` because there the expected `value` has to be a `string`.

CodeQL's `float` uses 64-bit and is therefore able to represent for example 1.555555555; yet `1.555555555.toString()` has 1.555556 as result.
These are not the same values, `1.555555555 = 1.555556` does not hold.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by locating the implementation of the built-in float.toString() predicate and the CodeQL QL InlineExpectationsTest mentioned in the issue. Reproduce the 1.555555555 example and inspect the existing expected string handling; done means the string preserves the float's precision and the relevant expectation passes.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.