mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-22 06:43:28 +03:00
ace23ebbe2
git-svn-id: svn://kolibrios.org@6433 a494cfbc-eb01-0410-851d-a64ba20cac60
45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include "test.h"
|
|
|
|
#define length(x) (sizeof(x) / sizeof *(x))
|
|
|
|
static struct {
|
|
char *s;
|
|
float f;
|
|
} t[] = {
|
|
// 2^-149 * 0.5 - eps
|
|
{".7006492321624085354618647916449580656401309709382578858785341419448955413429303e-45", 0},
|
|
// 2^-149 * 0.5 + eps
|
|
{".7006492321624085354618647916449580656401309709382578858785341419448955413429304e-45", 0x1p-149},
|
|
// 2^-149 * 0.5 - eps
|
|
{".2101947696487225606385594374934874196920392912814773657635602425834686624028790e-44", 0x1p-149},
|
|
// 2^-149 * 0.5 + eps
|
|
{".2101947696487225606385594374934874196920392912814773657635602425834686624028791e-44", 0x1p-148},
|
|
// 2^-126 + 2^-150 - eps
|
|
{".1175494420887210724209590083408724842314472120785184615334540294131831453944281e-37", 0x1p-126},
|
|
// 2^-126 + 2^-150 + eps
|
|
{".1175494420887210724209590083408724842314472120785184615334540294131831453944282e-37", 0x1.000002p-126},
|
|
// 2^128 - 2^103 - eps
|
|
{"340282356779733661637539395458142568447.9999999999999999999", 0x1.fffffep127},
|
|
// 2^128 - 2^103
|
|
{"340282356779733661637539395458142568448", INFINITY},
|
|
};
|
|
|
|
int main(void)
|
|
{
|
|
int i;
|
|
float x;
|
|
char *p;
|
|
|
|
for (i = 0; i < length(t); i++) {
|
|
x = strtof(t[i].s, &p);
|
|
if (x != t[i].f)
|
|
t_error("strtof(\"%s\") want %a got %a\n", t[i].s, t[i].f, x);
|
|
}
|
|
|
|
printf("%s finished\n", __FILE__);
|
|
return t_status;
|
|
}
|