mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Get more Python tests passing (#141)
This commit is contained in:
parent
916f19eea1
commit
59e1c245d1
141 changed files with 3536 additions and 1203 deletions
|
@ -1,5 +1,5 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Musl Libc │
|
||||
|
@ -26,20 +26,14 @@
|
|||
│ │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/math.h"
|
||||
#include "libc/tinymath/feval.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
Musl libc (MIT License)\\n\
|
||||
Copyright 2005-2014 Rich Felker, et. al.\"");
|
||||
asm(".include \"libc/disclaimer.inc\"");
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
static inline void force_eval(float x)
|
||||
{
|
||||
volatile float y;
|
||||
y = x;
|
||||
}
|
||||
|
||||
float nextafterf(float x, float y)
|
||||
{
|
||||
union {float f; uint32_t i;} ux={x}, uy={y};
|
||||
|
@ -62,9 +56,9 @@ float nextafterf(float x, float y)
|
|||
e = ux.i & 0x7f800000;
|
||||
/* raise overflow if ux.f is infinite and x is finite */
|
||||
if (e == 0x7f800000)
|
||||
force_eval(x+x);
|
||||
feval(x+x);
|
||||
/* raise underflow if ux.f is subnormal or zero */
|
||||
if (e == 0)
|
||||
force_eval(x*x + ux.f*ux.f);
|
||||
feval(x*x + ux.f*ux.f);
|
||||
return ux.f;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue