Search found 9 matches

by mksully22
Wed Oct 03, 2018 3:43 pm
Forum: Development of MicroPython
Topic: float() different result returned for ppc64 vs x86_64
Replies: 9
Views: 568

Re: float() different result returned for ppc64 vs x86_64

If consistency across architectures to meet https://en.wikipedia.org/wiki/IEEE_754 is the objective then it would seem to be necessary to build with the -ffp-contract=off. I think this change would fix the problem as long as there are no objections?
by mksully22
Wed Oct 03, 2018 1:48 pm
Forum: Development of MicroPython
Topic: float() different result returned for ppc64 vs x86_64
Replies: 9
Views: 568

Re: float() different result returned for ppc64 vs x86_64

As suggested, to see the values returned from a "float('.' + '9' * 70)" operation a breakpoint was added at float_print(). When hit the value of self->value ( and o_val) shows that when building micropython with default cflags x86_64 computes a float value of 1, while ppc64 computes a float value of...
by mksully22
Tue Oct 02, 2018 9:08 pm
Forum: Development of MicroPython
Topic: float() different result returned for ppc64 vs x86_64
Replies: 9
Views: 568

Re: float() different result returned for ppc64 vs x86_64

I ran across https://bugs.mysql.com/bug.php?id=82760 that describes how floating point calculations can be a bit different on some cpu types when using the "-Os" compiler optimization settings. Because -Os enables the -fexpensive-optimizations option which causes ppc64 to compute floating point oper...
by mksully22
Tue Oct 02, 2018 6:45 pm
Forum: Development of MicroPython
Topic: float() different result returned for ppc64 vs x86_64
Replies: 9
Views: 568

Re: float() different result returned for ppc64 vs x86_64

There were a couple of issues posted in thread viewtopic.php?f=3&t=5247 but the inconsistency between the ppc64 and x86_64 result wasn't addressed so was split out here. Do you know of another thread? I searched but couldn't find a specific resolution? Thanks
by mksully22
Tue Oct 02, 2018 6:13 pm
Forum: Development of MicroPython
Topic: float() different result returned for ppc64 vs x86_64
Replies: 9
Views: 568

float() different result returned for ppc64 vs x86_64

My understanding is that all hardware/software should implement https://en.wikipedia.org/wiki/IEEE_754 and return the same results. However when issuing float operations I see differences in results that cause the float_parse.py test to fail between ppc64 and x86_64: PPC64 result: ~/aports/testing/m...
by mksully22
Tue Sep 11, 2018 3:57 pm
Forum: Development of MicroPython
Topic: float() consistency with python3
Replies: 5
Views: 389

Re: float() consistency with python3

On my Power8 box:
>>> float('.' + '9' * 70)
1.000000000000001

on my x86_64 laptop:
>>> float('.' + '9' * 70)
1.0
by mksully22
Tue Sep 11, 2018 3:38 pm
Forum: Development of MicroPython
Topic: float() consistency with python3
Replies: 5
Views: 389

Re: float() consistency with python3

Any insight on why ppc64le and x86_64 would return different results for float('.' + '9' * 70)? Are different results expected for different cpu types?
by mksully22
Tue Sep 11, 2018 12:41 pm
Forum: Development of MicroPython
Topic: float() consistency with python3
Replies: 5
Views: 389

float() consistency with python3

I am encountering slight differences in float() output between micropython and python3 in an alpine linux container, is this expected behavior? Micropython: ~/aports/testing/micropython/src/micropython-1.9.4/tests $ ../ports/unix/micropython MicroPython v3.8.0-1909-g685fa426c5-dirty on 2018-09-11; l...