Skip to main content
Glama
emicklei

melrōse musical expression player

by emicklei
number_compare.go1.09 kB
package calc import ( "fmt" "github.com/emicklei/melrose/core" ) type NumberCompare struct { Left any Right any Operator string } func (a NumberCompare) Storex() string { return fmt.Sprintf("%s %s %s", core.Storex(a.Left), a.Operator, core.Storex(a.Right)) } func (a NumberCompare) Value() any { isFloatOp := false if _, ok := a.Left.(float64); ok { isFloatOp = true } if _, ok := a.Right.(float64); ok { isFloatOp = true } if isFloatOp { l, _ := resolveFloatWithInt(a.Left) r, _ := resolveFloatWithInt(a.Right) switch a.Operator { case "<": return l < r case "<=": return l <= r case ">": return l > r case ">=": return l >= r case "!=": return l != r case "==": return l == r default: return false } } l, ok := resolveInt(a.Left) if !ok { l = 0 } r, ok := resolveInt(a.Right) if !ok { r = 0 } switch a.Operator { case "<": return l < r case "<=": return l <= r case ">": return l > r case ">=": return l >= r case "!=": return l != r case "==": return l == r default: return false } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/emicklei/melrose'

If you have feedback or need assistance with the MCP directory API, please join our Discord server