Subversion Repositories HelenOS-historic

Rev

Rev 572 | Rev 652 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
535 cejka 1
/*
2
 * Copyright (C) 2005 Josef Cejka
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
29
#include<softfloat.h>
647 cejka 30
#include<sftypes.h>
31
#include<arithmetic.h>
32
#include<conversion.h>
33
#include<comparison.h>
34
#include<other.h>
535 cejka 35
 
647 cejka 36
/* Arithmetic functions */
542 cejka 37
 
38
float __addsf3(float a, float b)
39
{
40
    float32 fa, fb;
563 cejka 41
    fa.f=a;
42
    fb.f=b;
647 cejka 43
    if (fa.parts.sign!=fb.parts.sign) {
44
        if (fa.parts.sign) {
45
            fa.parts.sign=0;
46
            return subFloat32(fb,fa).f;
47
        };
48
        fb.parts.sign=0;
49
        return subFloat32(fa,fb).f;
50
    }
563 cejka 51
    return addFloat32(fa,fb).f;
542 cejka 52
};
53
 
54
float __subsf3(float a, float b)
55
{
56
    float32 fa, fb;
563 cejka 57
    fa.f=a;
58
    fb.f=b;
647 cejka 59
    if (fa.parts.sign!=fb.parts.sign) {
60
        fb.parts.sign!=fb.parts.sign;
61
        return addFloat32(fa,fb).f;
62
    }
563 cejka 63
    return subFloat32(fa,fb).f;
542 cejka 64
};
65
 
66
float __negsf2(float a)
67
{
68
    float32 fa;
69
    fa.f=a;
70
    fa.parts.sign=!fa.parts.sign;
71
    return fa.f;
72
};
73
 
74
double __negdf2(double a)
75
{
76
    float64 fa;
563 cejka 77
    fa.d=a;
542 cejka 78
    fa.parts.sign=!fa.parts.sign;
563 cejka 79
    return fa.d;
542 cejka 80
};
81
 
647 cejka 82
/* Conversion functions */
542 cejka 83
 
647 cejka 84
/* Comparison functions */
542 cejka 85
 
647 cejka 86
/* Other functions */
542 cejka 87