6 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for ravenous

At work we have a large number of unit tests that try to alert us that we have made changes that have broken our code. Many of these tests work by evaluating functions under known conditions and comparing the result with the known result. The known result is acquired by …

Member Avatar for santakdalai90
0
303
Member Avatar for Mouche

Hello. I wrote a program to convert decimal fraction values into binary fractions. I seem to be running into some floating point accuracy problems. After multiplying a floating point number by 2 over and over, eventually the number becomes corrupted. Since I'm multiplying so many times, I think the error …

Member Avatar for Mouche
0
240
Member Avatar for knan

We know that 0.1 + 0.1 + 0.1 - 0.3 = 0.0 But in python 0.1 + 0.1 + 0.1 - 0.3 = 5.5511151231257827e-017 Is there any way I can get 0.0...??

Member Avatar for knan
0
195
Member Avatar for Sunshineserene
Member Avatar for Gribouillis

How would you safely round a floating point number to the nearest integer ? Python has the built in function [icode]round[/icode], but it returns a floating point number [code=python] >>> round(4.9) 5.0 >>> help(round) Help on built-in function round in module __builtin__: round(...) round(number[, ndigits]) -> floating point number Round …

Member Avatar for Gribouillis
0
3K
Member Avatar for Duncans Ghola

This program is intended to determine if a fractions is valid (non-zero, non-negative denominator) and to convert an improper fraction into a whole/mixed number. While running the program I get the message "Floating point exception" after it reads the inputs just inside the for loop. Any insight into what is …

Member Avatar for Grn Xtrm
1
248

The End.