From 333dd658f6564b11b91d19597caa57044f81da18 Mon Sep 17 00:00:00 2001 From: litlighilit Date: Fri, 27 Sep 2024 00:30:46 +0800 Subject: [PATCH] fix(doc): lgamma doc thought NaN == NaN; math_patch.consts used bare * --- src/pylib/Lib/math_patch/consts.nim | 2 +- src/pylib/Lib/math_patch/lgamma.nim | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pylib/Lib/math_patch/consts.nim b/src/pylib/Lib/math_patch/consts.nim index 78cbc3868..e8a11a204 100644 --- a/src/pylib/Lib/math_patch/consts.nim +++ b/src/pylib/Lib/math_patch/consts.nim @@ -5,7 +5,7 @@ const EULER* = ## euler_gamma 0.577215664901532860606512090082402431042 - SQRT_TWO_PI* = ## sqrt(2*PI) <-> sqrt(TAU) + SQRT_TWO_PI* = ## `sqrt(2*PI)` <-> `sqrt(TAU)` 2.506628274631000502415765284811045253 template maxSafeInteger*(F: typedesc[SomeFloat]): F = diff --git a/src/pylib/Lib/math_patch/lgamma.nim b/src/pylib/Lib/math_patch/lgamma.nim index 5a078687f..369e78b4e 100644 --- a/src/pylib/Lib/math_patch/lgamma.nim +++ b/src/pylib/Lib/math_patch/lgamma.nim @@ -386,9 +386,10 @@ func lgamma*[F: SomeFloat](x: F): F = ]## runnableExamples: + from std/math import isNaN assert lgamma(1.0) == 0.0 assert lgamma(Inf) == Inf - assert lgamma(NaN) == NaN + assert lgamma(NaN).isNaN mapRaiseGammaErr x.lgamma result func stdlibJsLgamma*[F: SomeFloat](x: F): F{.raises: [].} =