Recent

Author Topic: Where could I find documentation on nan  (Read 6196 times)

ArtLogi

  • Full Member
  • ***
  • Posts: 172
Re: Where could I find documentation on nan
« Reply #30 on: February 06, 2021, 02:16:45 am »
Or maybe the system that defines it have flaws. But again I have not devoted my life to proof it to direction or another, not that a single life would be enough.  :D  Where on earth I have come across the Paranoia pascal source....

Here? http://www.netlib.no/netlib/paranoia/paranoia.p

See also https://archive.org/details/byte-magazine-1985-02/1985_02_BYTE_10-02_Computing_and_the_Sciences pp223-235 (Nota bene: 627Mb file).

I've extracted the relevant pages of the Byte edition above to a PDF, but it still comes to 7.4Mb which is too large to upload here. If anybody actually wants it please say and I'll hide it on my company website.

MarkMLl
Oh, that was the one I was referring. Thanks. Need to try to compile it someday, just for curiosity. It is somewhat amusing that is was originally written in Basic, maybe just to make statement. Dr. Kahan seems a bit that kind of persona. ::)

Now one or two beers later the calculations with undefined values can continue.  :D

Then drop in the non-zero zero and assume that all infinities do have same revision number (so ∞=∞ and argument of non-division do not apply, think we overwrite some of the parent methods here)

A) 0.0^0 = 1/∞ / 1/∞   
B) 1/∞//1/∞ = 1 /// 1/∞ // 1/∞

Lets rearrange the B as
B) 1/∞ * ∞/1 =  1 // 1/∞ * ∞/1


Sir!

Computing with infinity is forbidden.

Because as we all know:

Code: Text  [Select][+][-]
  1. ∞ + 23 = ∞

Winni
So is computing with undefined results, makes no difference.  :D My notation was wrong as the infinity is sacred, maybe I should have (mis)used the ω as I did with o.
Code: Text  [Select][+][-]
  1. ∞ + 23 = ∞
No I did specify exception, that addition operation would need to be revisioned to something like ∞_0 + 23 = ∞_23, which wouldn't fulfill the ∞=∞ as ∞_0  ≠ ∞_23. Same product number, different configuration. Makes one wonder can you make summation of known to infinity if infinity already contains everything.  >:D


Hi!

One can create a lot of theories about this topic.

As math is just an auxiliary science  for physics, you can look at it from the astrophysicians point of view:

What if 0 ^ 0 was just the moment of the Big Bang where 1=0  ????
A mini-minimum later everything is fine and solvable:

(1^-100 )   ^ (1^-100) has not that paradox problem anymore.
You can compute it. Not on a PC Proessor - but you can,

Winni

PS.: Nice song for this topic: "If 6 was 9", Jimi Hendrix

Maybe at that point of big-bang all the matter was sucked in and magnetic field was at max. Later at mini-minimum point you defined the collapsing of it was started and movement of matter had started as expansion.  :P >:D
"As math is just an auxiliary science  for physics" I have heard it this one or two times, in my life. Wasn't it continuing something like: ...but then soon after you need to go to ask: "dear mathematician could you explain this thing to me." one rather unknown quantum-physicist, if I'm not terribly mistaken.

The inverse primes (form 1/x , can't get right term to my head atm.) are also fascinating subject, I think I have read that there is now computational proof that they are solid. Not the series which is proven like Euler.

Back to reality. If calculating something with floats at least the implementation should be such that the erroneous answer is given by same actions in all platforms that follows floating point standard. For me and other who belongs to that 95% who have no idea (as Dr.Kahan painted it), it is important. If there is widely accepted and well defined standard should it be implemented (I'm pretty sure that most of it is in the FPC as there is some high-rank academic backing among the compiler developers).
« Last Edit: February 06, 2021, 02:37:20 am by ArtLogi »
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

MarkMLl

  • Hero Member
  • *****
  • Posts: 3458
Re: Where could I find documentation on nan
« Reply #31 on: February 06, 2021, 10:35:21 am »
"As math is just an auxiliary science  for physics" I have heard it this one or two times, in my life. Wasn't it continuing something like: ...but then soon after you need to go to ask: "dear mathematician could you explain this thing to me." one rather unknown quantum-physicist, if I'm not terribly mistaken.

Obligatory XKCD https://xkcd.com/435/ and presumably you're thinking of Levi-Civita :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ArtLogi

  • Full Member
  • ***
  • Posts: 172
Re: Where could I find documentation on nan
« Reply #32 on: February 06, 2021, 02:55:08 pm »
"As math is just an auxiliary science  for physics" I have heard it this one or two times, in my life. Wasn't it continuing something like: ...but then soon after you need to go to ask: "dear mathematician could you explain this thing to me." one rather unknown quantum-physicist, if I'm not terribly mistaken.

Obligatory XKCD https://xkcd.com/435/ and presumably you're thinking of Levi-Civita :-)

MarkMLl
Those XKCDs are hilarious, I haven't seen them before. Negative also to other part, Levi-Civita was not familiar to me at all, interesting work, thank you. The rather unknown quantum-mechanic was dr. Feynman, there is part of his lecture named something like "difference between mathematician and physicist", plenty of those on youtube where he is ventilating his head. His later lectures (some form of summer school or something) about computers are hilarious.  ::)
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

MarkMLl

  • Hero Member
  • *****
  • Posts: 3458
Re: Where could I find documentation on nan
« Reply #33 on: February 06, 2021, 03:08:36 pm »
Those XKCDs are hilarious, I haven't seen them before.

They're highly regarded (as is their author: who else could commandeer Serena Williams for a science experiment?), and sufficiently wide-ranging that "obligatory xkxd" is a "thing" in its own right.

Quote
Negative also to other part, Levi-Civita was not familiar to me at all, interesting work, thank you. The rather unknown quantum-mechanic was dr. Feynman, there is part of his lecture named something like "difference between mathematician and physicist", plenty of those on youtube where he is ventilating his head. His later lectures (some form of summer school or something) about computers are hilarious.  ::)

I thought you were referring to the correspondence between Levi-Civita and Einstein. I believe that there was also some interesting interaction between Einstein and Gabriel Kron (see Wp)... regrettably, Kron has been seized upon by the flying saucer brigade since he had the temerity to invent a circuit that exhibited negative resistance.

Feynman was at one time a consultant/employee of Thinking Machines. At one point they asked him how big a communications buffer should be, and were astonished when he attacked the problem using differential equations... and sufficiently sceptical that they added a bit extra to his result. Experience later indicated that he's been spot-on.

MarkMLl
« Last Edit: February 06, 2021, 03:13:57 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ArtLogi

  • Full Member
  • ***
  • Posts: 172
Re: Where could I find documentation on nan
« Reply #34 on: February 06, 2021, 11:23:46 pm »
It is unfortunate that brigade is still so prevalent even though we have dispersed negative resistance oscillators for many decades to electrical equipment for distraction as Tesla adviced.

Psst. Don't tell anyone but neonbulbs are actually even better control devices at negative resistance region after we get 5G network up and they start to oscillate at microwave region. We got the ingenious COBOL sources from Steinmetz, which thought to be long lost.
« Last Edit: February 06, 2021, 11:28:53 pm by ArtLogi »
While Record is a drawer and method is a clerk, when both are combined to same space it forms an concept of office, which is alias for a great suffering.

MarkMLl

  • Hero Member
  • *****
  • Posts: 3458
Re: Where could I find documentation on nan
« Reply #35 on: October 12, 2021, 04:48:22 pm »
Knowing that despite being old this will come to the attention of people with an interest in these things: how can I check whether a double is actually set to NaN?

Area of application is a data structure being returned via a C API, where most of the time (when sensible data has not yet been assembled) the content is described by Lazarus as


FIX = {TIME = nan(0x8000000000000),
MODE = 0,
EPT = nan(0x8000000000000),
LATITUDE = nan(0x8000000000000),
EPY = nan(0x8000000000000),
LONGITUDE = nan(0x8000000000000),
...


The original C client explicitly uses an isNaN test:

Code: C  [Select][+][-]
  1.     /* Print time/date. */
  2.     if (isnan(gpsdata->fix.time) == 0) {
  3.         (void)unix_to_iso8601(gpsdata->fix.time, scr, sizeof(scr));
  4. ...
  5.  

and while I suspect that there's better ways of doing it the documentation is sufficiently flaky that I think that's the best place to start.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

avk

  • Hero Member
  • *****
  • Posts: 504
    • my self-education project
Re: Where could I find documentation on nan
« Reply #36 on: October 12, 2021, 05:53:48 pm »
If you have SysUtils in your uses clause, why not just ask if gpsdata.fix.time.IsNaN?

MarkMLl

  • Hero Member
  • *****
  • Posts: 3458
Re: Where could I find documentation on nan
« Reply #37 on: October 12, 2021, 06:23:32 pm »
Dagnabbit: how on Earth did I miss that? I've been trawling the RTL index pages for half the afternoon looking for that and other things.

In the interim I've worked out the status bits I need to do the job properly, so the question is moot. But the answer's still worth knowing (and getting into the record here): thanks.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

avk

  • Hero Member
  • *****
  • Posts: 504
    • my self-education project
Re: Where could I find documentation on nan
« Reply #38 on: October 12, 2021, 06:44:24 pm »
Well, a homemade IsNan() might look something like this:
Code: Pascal  [Select][+][-]
  1. function IsNan(d: Double): Boolean;
  2. var
  3.   q: QWord absolute d;
  4. const
  5.   InfExp = QWord($7ff0000000000000);
  6. begin
  7.   Result := (q and InfExp = InfExp) and (q and Pred(QWord(1) shl 52) <> 0);
  8. end;
  9.  

MarkMLl

  • Hero Member
  • *****
  • Posts: 3458
Re: Where could I find documentation on nan
« Reply #39 on: October 12, 2021, 07:30:51 pm »
Yes. However it turns out that the API I'm using has status bits saying exactly which groups of fields are valid... it's just that the documentation is so bad that even the accompanying demo programs don't use them properly.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 3490
  • Compiler Developer
Re: Where could I find documentation on nan
« Reply #40 on: October 13, 2021, 09:55:58 am »
If you have SysUtils in your uses clause, why not just ask if gpsdata.fix.time.IsNaN?

Or the old school IsNaN function from unit Math ;)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9680
  • FPC developer.
Re: Where could I find documentation on nan
« Reply #41 on: October 13, 2021, 10:32:18 am »
If you have SysUtils in your uses clause, why not just ask if gpsdata.fix.time.IsNaN?

Or the old school IsNaN function from unit Math ;)

And if that is too old-skool, use the slightly newer version from TFloatHelper in sysutils  ;)

PascalDragon

  • Hero Member
  • *****
  • Posts: 3490
  • Compiler Developer
Re: Where could I find documentation on nan
« Reply #42 on: October 13, 2021, 01:40:47 pm »
If you have SysUtils in your uses clause, why not just ask if gpsdata.fix.time.IsNaN?

Or the old school IsNaN function from unit Math ;)

And if that is too old-skool, use the slightly newer version from TFloatHelper in sysutils  ;)

That's what avk already suggested in what I had quoted... ;D

MarkMLl

  • Hero Member
  • *****
  • Posts: 3458
Re: Where could I find documentation on nan
« Reply #43 on: October 13, 2021, 03:19:47 pm »
In any event, the fault for all of this rests firmly on my shoulders for failing to see the bleedin' obvious :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018