mirror of
https://github.com/golang/go
synced 2024-10-04 19:31:21 -06:00
091047f36c
R=r DELTA=1685 (920 added, 765 deleted, 0 changed) OCL=14030 CL=14030
54 lines
638 B
C
54 lines
638 B
C
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
#include "go.h"
|
|
|
|
/// implements float arihmetic
|
|
|
|
void
|
|
mpaddfltflt(Mpflt *a, Mpflt *b)
|
|
{
|
|
a->val += b->val;
|
|
}
|
|
|
|
void
|
|
mpmulfltflt(Mpflt *a, Mpflt *b)
|
|
{
|
|
a->val *= b->val;
|
|
}
|
|
|
|
void
|
|
mpdivfltflt(Mpflt *a, Mpflt *b)
|
|
{
|
|
a->val /= b->val;
|
|
}
|
|
|
|
double
|
|
mpgetflt(Mpflt *a)
|
|
{
|
|
return a->val;
|
|
}
|
|
|
|
void
|
|
mpmovecflt(Mpflt *a, double c)
|
|
{
|
|
a->val = c;
|
|
}
|
|
|
|
void
|
|
mpnegflt(Mpflt *a)
|
|
{
|
|
a->val = -a->val;
|
|
}
|
|
|
|
int
|
|
mptestflt(Mpflt *a)
|
|
{
|
|
if(a->val < 0)
|
|
return -1;
|
|
if(a->val > 0)
|
|
return +1;
|
|
return 0;
|
|
}
|