Skip to content

fld1 is weird #28973

Closed
Closed
@jleugeri

Description

@jleugeri

Hi.

I necro-posted this as a comment in a different issue ( #14487 ), which is open since 2015 and thus probably won't get looked at any time soon. So here goes. I was playing around with fld1 on Julia 1.0 on a Ubuntu system, delved too deep and awoke something in Khazad-dum.

fld and cld work as expected:

julia> fld(0.09, 0.1)
0.0
julia> fld(0.08, 0.1)
0.0
julia> fld(0.07, 0.1)
0.0
julia> fld(0.06, 0.1)
0.0

and

julia> cld(0.09, 0.1)
1.0
julia> cld(0.08, 0.1)
1.0
julia> cld(0.07, 0.1)
1.0
julia> cld(0.06, 0.1)
1.0

However:

julia> fld1(0.09, 0.1)
1.0
julia> fld1(0.08, 0.1)
0.0
julia> fld1(0.07, 0.1)
1.0
julia> fld1(0.06, 0.1)
1.0

WAT.

My system:

Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 16.04.5 LTS
  uname: Linux 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64
  CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz: 
              speed         user         nice          sys         idle          irq
       #1  2998 MHz   29220504 s  374401370 s   16316182 s  412409612 s          0 s
       #2  3495 MHz   25098103 s  389922335 s    8533915 s  413120981 s          0 s
       #3  2506 MHz   32293244 s  397619253 s    7969477 s  399074571 s          0 s
       #4  2546 MHz   27990786 s  380869437 s    7981724 s  420045227 s          0 s
       #5  3026 MHz   19610614 s  405248460 s    6253806 s  406291328 s          0 s
       #6  3500 MHz   24186996 s  369161728 s    7044432 s  436747971 s          0 s
       #7  2207 MHz   25446131 s  399302571 s   10678770 s  402065306 s          0 s
       #8  1660 MHz   24326246 s  391760285 s   12716558 s  408596497 s          0 s
       
  Memory: 31.378002166748047 GB (3988.6875 MB free)
  Uptime: 8.380479e6 sec
  Load Avg:  0.2607421875  0.46875  0.4658203125
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)

Can anyone else reproduce this, or is this a problem uniquely on my system? I could easily live without fld1, but this result ... makes me nervous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecationThis change introduces or involves a deprecationmathsMathematical functionsneeds decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions