@@ -529,28 +529,33 @@ num2String [x] = throwError $ TypeMismatch "number" x
529
529
num2String badArgList = throwError $ NumArgs (Just 1 ) badArgList
530
530
531
531
532
+ -- | Determine if the given value is not a number
532
533
isNumNaN :: [LispVal ] -> ThrowsError LispVal
533
534
isNumNaN ([Float n]) = return $ Bool $ isNaN n
534
535
isNumNaN _ = return $ Bool False
535
536
537
+ -- | Determine if number is infinite
536
538
isNumInfinite :: [LispVal ] -> ThrowsError LispVal
537
539
isNumInfinite ([Float n]) = return $ Bool $ isInfinite n
538
540
isNumInfinite _ = return $ Bool False
539
541
542
+ -- | Determine if number is not infinite
540
543
isNumFinite :: [LispVal ] -> ThrowsError LispVal
541
544
isNumFinite ([Number _]) = return $ Bool True
542
545
isNumFinite ([Float n]) = return $ Bool $ not $ isInfinite n
543
546
isNumFinite ([Complex _]) = return $ Bool True
544
547
isNumFinite ([Rational _]) = return $ Bool True
545
548
isNumFinite _ = return $ Bool False
546
549
550
+ -- | Determine if number is exact
547
551
isNumExact :: [LispVal ] -> ThrowsError LispVal
548
552
isNumExact ([Number _]) = return $ Bool True
549
553
isNumExact ([Float _]) = return $ Bool False
550
554
isNumExact ([Complex _]) = return $ Bool False -- TODO: could be either
551
555
isNumExact ([Rational _]) = return $ Bool True
552
556
isNumExact _ = return $ Bool False
553
557
558
+ -- | Determine if number is inexact
554
559
isNumInexact :: [LispVal ] -> ThrowsError LispVal
555
560
isNumInexact n@ ([Number _]) = return $ Bool False
556
561
isNumInexact n@ ([Float _]) = return $ Bool True
0 commit comments