Search

Wednesday, October 7, 2020

About Scratch :: Advanced Topics :: What happens when you divide by 0 in 1.4, 2.0, and 3.0?

Jonathan50 : Scratch 2 and 3 represent numbers with IEEE 754 floating-point arithmetic, because the programming languages that Scratch 2 and 3 are written in, ActionScript and JavaScript respectively, do so. That's why 1/0 reports infinity even though it isn't a number. (Because 1/1/x = x, then 1/Infinity yields 0.)

Scratch 1.x on the other hand is written in Squeak, so integers (whole numbers) represented by numerals without a point or scientific notation are represented by a machine word or as a big integer. (This is why Scratch 1.x precisely represents very big integers whereas newer versions just store approximations of them. Squeak also supports exact rationals, but this feature was disabled for Scratch, and so all fractions and integers that appear with a point or in scientific notation are represented by IEEE 754 floating-point numbers also.) Also I think the Scratch Team got rid of all script errors with Scratch 2 (and the Flash player – see here.)

--Explosion-- wrote:

I see.
The original post said “lighting.”

from Latest posts on Advanced Topics https://ift.tt/2SCkWig

No comments:

Post a Comment