s_nanl.c (3e13dd37ff4f7f828ca40ad691dad5a34cf6e8a6) | s_nanl.c (4b6b5744552e9cdf01eb22407dee9277a379476c) |
---|---|
1/*- 2 * Copyright (c) 2007 David Schultz 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 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29#include <math.h> 30 31#include "fpmath.h" | 1/*- 2 * Copyright (c) 2007 David Schultz 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 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 29#include <math.h> 30 31#include "fpmath.h" |
32#include "../src/math_private.h" | 32#include "../../../contrib/gdtoa/gdtoaimp.h" |
33 34long double 35nanl(const char *s) 36{ | 33 34long double 35nanl(const char *s) 36{ |
37 union { 38 union IEEEl2bits ieee; 39 uint32_t bits[4]; 40 } u; | 37 static FPI fpi = { 113, -16494, 16271, 1, SI }; |
41 | 38 |
42 _scan_nan(u.bits, 4, s); 43 u.ieee.bits.exp = 0x7fff; 44 u.ieee.bits.manh |= 1ULL << 47; /* make it a quiet NaN */ 45 return (u.ieee.e); | 39 union IEEEl2bits result; 40 ULong bits[2]; 41 int k; 42 43 s--; 44 k = hexnan(&s, &fpi, bits); 45 ULtoQ((UShort *)&result.e, bits, 16272, k); 46 return (result.e); |
46} | 47} |