• Ok - try now!

    Turns out it was two issues :)

    • On nRF52 (which I was using initially) we switched to use the FPU a while back and that messed up how doubles are passed - so code using doubles didn't work reliably. But you wouldn't have hit that (probably the code above would have worked fine on the original Espruino)
    • The type handling of the unary minus (for -8.0) was wrong - and I think that's what hit you

    Running:

    function F(x){
    "compiled";
    return 1/(1.13+Math.exp(-8.0*(x-0.54)))+0.14;
    }
    function G(x){
    return 1/(1.13+Math.exp(-8.0*(x-0.54)))+0.14;
    }
    for (var i=0;i<10;i++) {
      print(F(i),G(i));
    }
    

    Now shows the right values for me

About

Avatar for ioi-655321 @ioi-655321 started