ScratchData LogoScratchData
Back to Sheep_maker's profile

How Scratch stores numbers in binary

SHSheep_maker•Created April 7, 2021
How Scratch stores numbers in binary
262
205
3585 views
View on Scratch

Description

Have you ever wondered how Scratch stores numbers in memory? Click on the bits to toggle them. Hover the bottom left corner to see what the bits represent. Click the "change" button and give a number to see its binary representation. Scratch and JavaScript both store numbers as double-precision floating-point numbers. They're in pretty much every programming language, under various names: JavaScript numbers, Python floats, Java doubles, Racket inexact numbers, Rust f64. Notably, floats have Infinity, -Infinity, -0, and NaN values, which you can find in every language. Most languages are compliant with IEEE 754, the specification that defines the behaviour of these floats. For example, 1.0 / -0.0 should be negative infinity. Some languages, like Scratch and Python, are not entirely compliant, unfortunately. Based on my JavaScript version: https://sheeptester.github.io/javascripts/floats.html?precision=64 Formulas from Wikipedia: https://en.wikipedia.org/wiki/Double-precision_floating-point_format

Project Details

Project ID512550879
CreatedApril 7, 2021
Last ModifiedApril 8, 2021
SharedApril 8, 2021
Visibilityvisible
CommentsAllowed