Skip to main content
Glama
intToBinaryString.js•498 B
'use strict'; var $floor = require('math-intrinsics/floor'); // https://runestone.academy/ns/books/published/pythonds/BasicDS/ConvertingDecimalNumberstoBinaryNumbers.html#:~:text=The%20Divide%20by%202%20algorithm,have%20a%20remainder%20of%200 module.exports = function intToBinaryString(x) { var str = ''; var y; while (x > 0) { y = x / 2; x = $floor(y); // eslint-disable-line no-param-reassign if (y === x) { str = '0' + str; } else { str = '1' + str; } } return str; };

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/guangxiangdebizi/PPT-MCP'

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