repl-legacy icon indicating copy to clipboard operation
repl-legacy copied to clipboard

UInt64.MaxValue = 0UL (at fable.io/repl) #1359

Open CetinSert opened this issue 8 years ago • 2 comments

Description

UInt64.MaxValue = 0UL holds true in Fable as imported on fable.io/repl:

Repro code

repl.it - F# 4 vs fable.io/repl

open System
open Fable.Import.Browser

[<Literal>]
let Z = 0UL
[<Literal>]
let I = 1UL
let R = UInt64.MaxValue
let X = UInt64.MaxValue - if Environment.OSVersion = null then I else Z

let init() =
  let e = document.querySelector("pre") :?> HTMLCanvasElement
  let t x = e.textContent <- e.textContent + "\n" + sprintf "%A" x
  t <| (R,X,System.Environment.OSVersion)

init()

Expected and actual results

UInt64.MaxValue = 0UL holds true; it should not.

Related information

https://github.com/fable-compiler/Fable/blob/master/src/js/fable-core/Long.ts https://github.com/dcodeIO/long.js/blob/master/src/long.js - testing this Long.MAX_UNSIGNED_VALUE.toString() = "18446744073709551615"

CetinSert avatar Mar 08 '18 13:03 CetinSert

For reference, https://github.com/fable-compiler/Fable/issues/1359

MangelMaxime avatar Mar 08 '18 14:03 MangelMaxime

@MangelMaxime @alfonsogarciacaro what is the recommended way to know if a piece of code is running in Fable?

CetinSert avatar Mar 09 '18 07:03 CetinSert