summaryrefslogtreecommitdiff
path: root/mpu/mpu-math-error.c
blob: e519c90c3bf51c56d3c2eade90c069541ff1cb41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/***************************************************************
  __MPU_MATH_ERROR.C

       This file contains source code of functions for
       MATH ERROOR operations.

       PART OF : MPU - library .

       USAGE   : Internal only .

       NOTE    : NONE .

       Copyright (C) 2000 - 2024  by Andrew V.Kosteltsev.
       All Rights Reserved.
 ***************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <nls.h>

#include <errno.h>

#include <libmpu.h>
#include <mpu-context.h>
#include <mpu-symbols.h>

#include <mpu-math-errno.h>

/*
  __mpu_math_error() работает с внешним форматом чисел.

  Пользователь может определить собственную функцию
  __mpu_math_error() в качестве замены данного стандартного
  обработчика математических ошибок.
 */

int __use_default_math_error = 1;

int __mpu_math_error( struct __exception *pexcept )
{
  /* NOTE: ******************************************************
       if( RETURN( 0 ) ) [ - ОШИБКА НЕ ОБРАБОТАНА]
           надо печатать сообщение об ошибке и переменной ERRNO
           присваивать соответствующее значение.
       if( RETURN( 1 ) ) [ - ОШИБКА ОБРАБОТАНА]
           сообщение об ошибке не печатается и значение переменной
           ERRNO остается неизменным.
   ***************************************************************/
  if( pexcept->type == __INEXACT__ )
  {
    return( 1 );
  }

  return( 0 );
}