Skip to content

Commit

Permalink
fix NaN issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Feb 22, 2024
1 parent 2cb252f commit 440f4fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (a *Analyzer) DoError(jerr *JavaError) (matched []SolutionPossibility, err
}
}
if len(e.Message) == 0 { // when ignore error message, error type provide 100% score weight
sol.Match /= 10 / 100
sol.Match /= 10.0 / 100
} else {
jemsg, _ := split(jerr.Message, '\n')
matches := lineMatchPercent(jemsg, e.Message) // error message weight: 90%
Expand Down
3 changes: 2 additions & 1 deletion cmd/mcla_wasm/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ func asJsValue(v any) (res js.Value) {
reflect.Float32, reflect.Float64:
return js.ValueOf(v)
}
fmt.Printf("Marshaling in asJsValue: %T %#v\n", v, v)
buf, err := json.Marshal(v)
if err != nil {
fmt.Println("Error in asJsValue: json.Marshal:", err)
panic(err)
}
var v1 any
if err = json.Unmarshal(buf, &v1); err != nil {
fmt.Println("Error in asJsValue: json.Unmarshal:", err)
panic(err)
}
return js.ValueOf(v1)
Expand Down

0 comments on commit 440f4fd

Please sign in to comment.