2 hours ago · Tech · hide · 0 comments

For a recent talk I examined some native JavaScript functions in Node, and ended up reading the source code for Math.max: extern macro Float64Max(float64, float64): float64; transitioning javascript builtin MathMax( js-implicit context: NativeContext)(...arguments): Number { let result: float64 = MINUS_V8_INFINITY; const argCount = arguments.length; for (let i: intptr = 0; i < argCount; i++) { const doubleValue = TruncateTaggedToFloat64(arguments[i]); result = Float64Max(result, doubleValue); } return Convert<Number>(result); } To better understand this function, I decided to write my own version in JavaScript:

No comments yet. Log in to reply on the Fediverse. Comments will appear here.