Calculation error for floor function floor(1.4/0.025)

11 vues (au cours des 30 derniers jours)
Shahar
Shahar le 20 Mai 2013
if x = floor(1.4/0.025) is 55 in Matlab, how does y = 1.4/0.025 is 56?

Réponse acceptée

Iain
Iain le 20 Mai 2013
1.4/0.025 actually evaluates to 55.9999999999999928946.
The error is in the FIFTEENTH decimal place, which is an extremely small error, however, it is less than 56, and will "floor" to 55.

Plus de réponses (1)

Zhang lu
Zhang lu le 20 Mai 2013
Hi
floor(1.4e3/0.025e3)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by