# Calculating Middle Points for Integer and Floating-Point Numbers

DevFeed: [Calculating Middle Points for Integer and Floating-Point Numbers](<https://devfeed.tech/articles/middle-point-38641.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_10_28_middle_point/>)

Published: 2020-10-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Programming](<https://devfeed.tech/topics/programming.md>), [floating-point](<https://devfeed.tech/topics/floating-point.md>), [math](<https://devfeed.tech/topics/math.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [exception](<https://devfeed.tech/tags/exception.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [function](<https://devfeed.tech/tags/function.md>), [programming](<https://devfeed.tech/tags/programming.md>), [test](<https://devfeed.tech/tags/test.md>)

## AI overview

This programming article examines how to calculate the middle point between two numbers. It discusses representable numeric subsets, input ordering and equality, integer cases with odd distances, and floating-point numbers.

## Source excerpt

Introduction Working with numbers in programming never was a simple thing. In math, we deal with various sets of numbers - whole numbers, rational, complex. All these sets are infinite - that means that for any number we can find another smaller one and one which is bigger. In programming when we work with numbers we deal with some subset of these sets - that many that can be represented with a given amount of bits. When we want to work with whole numbers we can use e.g. Integer, which are the numbers being able to be represented usually with 4 bits. For floating-point numbers - say Double - it is 8 bits. There is no plus or minus infinity (in Double there are +/- infinity, though they are used for special cases).