722563efae7c54c83c5eb25fefb135e98f5bc9113932e51e330bef54fef86959.tri (700B)
1 -- Pure binary64 implementation; trusted internal helpers. 2 !import native_math as N 3 !import binary64_kernels as K 4 !import binary64_layouts as L 5 !export answer 6 !export exact 7 !export precisionTiny 8 !export quiet 9 !export quietBit 10 11 answer word invalid divideZero overflow underflow inexact = 12 t word (t invalid (t divideZero (t overflow (t underflow inexact)))) 13 exact word = answer word t t t t t 14 quietBit word = N.odd (L.drop1 (L.drop2 (L.drop16 (L.drop32 word)))) 15 quiet word = K.choose word (N.add word 2251799813685248) (quietBit word) 16 precisionTiny scale n = let cut = N.subtract (K.width n) 53 in 17 let rounded = K.head (K.roundL cut n) in 18 N.lte (N.add (N.add scale cut) (K.width rounded)) 1282