Revision d24316ac6465302aa32d9616ab731499c3734bce authored by Nathan Zimmerberg on 07 February 2024, 15:53:14 UTC, committed by GitHub on 07 February 2024, 15:53:14 UTC
Fixes #51731 and #51730 

Also fixes one of the previously broken tests:
```julia
@test_broken Rational{Int64}(UInt(1), typemin(Int32)) == Int64(1) // Int64(typemin(Int32))
```

This PR ensures the `Rational{T}` constructor with concrete `T` will
only throw if the final numerator and denominator cannot be represented
by `T`, or are both zero.

If the `T` in `Rational{T}` is not concrete, this PR tries to ensure the
numerator and denominator are promoted to the same type.
This means `-1*Rational{Integer}(-1, 0x01) == 1` doesn't throw now. A
side effect of this is that `Rational{Integer}(Int8(-1), 0x01)` now
throws.

Also, related to
<https://github.com/JuliaLang/julia/pull/25702#issuecomment-359821951>,
now `divgcd` doesn't change the types of its inputs and can handle
`typemin`, but it still throws a `DivideError` if both inputs are zero.
1 parent 736eeda
Raw File
Makefile
# Makefile for building documentation

default: html

# You can set these variables from the command line.
SRCDIR           := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
JULIAHOME        := $(abspath $(SRCDIR)/..)
SRCCACHE         := $(abspath $(JULIAHOME)/deps/srccache)
include $(JULIAHOME)/Make.inc
JULIA_EXECUTABLE := $(call spawn,$(build_bindir)/julia) --startup-file=no

.PHONY: help clean cleanall html pdf deps deploy

help:
	@echo "Please use 'make <target>' where <target> is one of"
	@echo "  html  to make standalone HTML files"
	@echo "  pdf   to make standalone PDF file"
	@echo
	@echo "To run linkcheck, use 'make <target> linkcheck=true'"
	@echo "To run doctests, use 'make <target> doctest=true'"
	@echo "To fix outdated doctests, use 'make <target> doctest=fix'"
	@echo "To run doctests using Revise (to test changes without rebuilding the sysimage), use 'make <target> doctest=true revise=true'"


DOCUMENTER_OPTIONS := linkcheck=$(linkcheck) doctest=$(doctest) buildroot=$(call cygpath_w,$(BUILDROOT)) \
    texplatform=$(texplatform) revise=$(revise)

UNICODE_DATA_VERSION=13.0.0
$(SRCCACHE)/UnicodeData-$(UNICODE_DATA_VERSION).txt:
	@mkdir -p "$(SRCCACHE)"
	$(JLDOWNLOAD) "$@" https://www.unicode.org/Public/$(UNICODE_DATA_VERSION)/ucd/UnicodeData.txt

deps: $(SRCCACHE)/UnicodeData-$(UNICODE_DATA_VERSION).txt
	$(JLCHECKSUM) "$<"
	cp "$<" UnicodeData.txt

checksum-unicodedata: $(SRCCACHE)/UnicodeData-$(UNICODE_DATA_VERSION).txt
	$(JLCHECKSUM) "$<"

clean:
	rm -rf _build/* deps/* docbuild.log UnicodeData.txt

cleanall: clean

html: deps
	@echo "Building HTML documentation."
	$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) $(DOCUMENTER_OPTIONS)
	@echo "Build finished. The HTML pages are in _build/html."

pdf: deps
	@echo "Building PDF documentation."
	$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) -- pdf $(DOCUMENTER_OPTIONS)
	@echo "Build finished."

# The deploy target should only be called in CI builds
deploy: deps
	@echo "Deploying HTML documentation."
	$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) -- deploy $(DOCUMENTER_OPTIONS)
	@echo "Build & deploy of docs finished."
back to top