Floating point calculation problem

Chris Angelico rosuav at gmail.com
Sat Feb 2 12:58:46 CET 2013


On Sat, Feb 2, 2013 at 10:51 PM, Schizoid Man <schiz_man at 21stcentury.com> wrote:
>> If your input has no decimal point in it, eval (or input) will return
>> an integer, not a float. Other than that, I can't see any obvious
>> reason for there to be a difference. Can you put together a simple
>> script that demonstrates the problem and post it, along with the exact
>> input that you're giving it, and the different outputs?
>
>
> Understood. I'm trying to learn Python by porting an ODE solver I wrote over
> from C#, so what I'll do is break down the routine and append a small code
> snippet highlighting the difference.

Thanks, I think I can speak for all of us in expressing appreciation
for that effort! It makes the job so much easier.

> I know this is probably redundant but Python 2.7.3 is running on a Mac and
> 3.3.0 on a PC, so it's not exactly an apples-v-apples comparison.

Ah, there may well be something in that. Definitely post the code and
outputs; chances are someone'll spot the difference.

ChrisA



More information about the Python-list mailing list