1
0
mirror of https://github.com/golang/go synced 2024-10-04 07:11:21 -06:00
go/src/cmd/gc/mparith3.c
Ken Thompson 091047f36c adding and deleting files
R=r
DELTA=1685  (920 added, 765 deleted, 0 changed)
OCL=14030
CL=14030
2008-08-09 17:33:35 -07:00

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;
}